dsteiner script as docker container, capable of refreshing tokens automatically
refreshtoken should be persistent, otherwise we would need to change the tokens everytime we restart the container
Container runs per default in "deamon" mode, meaning that every hour the invoices of the current month are being downloaded
- build container
$ docker build -t tesla-invoices .
- write refresh token and access token to
secrets/refresh_token.txt
andsecrets/access_token.txt
- (optional) email export
a. copydocker.env.example
todocker.env
b. fill in all variables and setENABLE_EMAIL_EXPORT
to "True"
c. start container with--env-file
$ docker run -d --name tesla-invoices -v ./invoices:/opt/tesla-invoices/invoices -v ./secrets:/opt/tesla-invoices/secrets --env-file docker.env tesla-invoices
- if you want no email export just run without
--env-file
a.b. create invoices interactively$ docker run -d --name tesla-invoices -v ./invoices:/opt/tesla-invoices/invoices -v ./secrets:/opt/tesla-invoices/secrets tesla-invoices
$ docker exec -it tesla-invoices ./download_v2.py Bitte gewünschten Monat im Format 'YYYY-MM' bzw. 'cur' oder 'prev' oder 'all' für aktuellen oder vorherigen Monat oder alles eingeben [prev]: cur Using '2024-04'. DONE
docker build -t tesla-invoices .
docker stop tesla-invoices
docker rm tesla-invoices
docker run -d --name tesla-invoices -v ./invoices:/opt/tesla-invoices/invoices -v ./secrets:/opt/tesla-invoices/secrets --env-file docker.env tesla-invoices