Skip to content

Commit

Permalink
Added support for .env files
Browse files Browse the repository at this point in the history
  • Loading branch information
jrast committed Oct 2, 2023
1 parent 51b6b70 commit d148460
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
GARMIN_USERNAME=<your username / email>
GARMIN_PASSWORD=<your password>
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
dist/
.idea
*.json
.env
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def read(fname):
"Topic :: Utilities",
"License :: OSI Approved :: MIT License",
],
install_requires=["lxml", "requests", "garth"],
install_requires=["lxml", "requests", "garth", "python-dotenv"],
entry_points={
"console_scripts": ["withings-sync=withings_sync.sync:main"],
},
Expand Down
3 changes: 3 additions & 0 deletions withings_sync/sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import os
import logging
import json
import dotenv

from datetime import date, datetime
from importlib.metadata import version
Expand All @@ -26,6 +27,8 @@
except OSError:
GARMIN_PASSWORD = ""

dotenv.load_dotenv()

if "GARMIN_USERNAME" in os.environ:
GARMIN_USERNAME = os.getenv("GARMIN_USERNAME")

Expand Down

0 comments on commit d148460

Please sign in to comment.