Skip to content

Commit

Permalink
Digi-Key API: raised logger output level to critical
Browse files Browse the repository at this point in the history
Reloading environmental variables when settings are changed
  • Loading branch information
eeintech committed Aug 12, 2021
1 parent 7e5f535 commit cfa54ba
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 6 deletions.
1 change: 1 addition & 0 deletions kintree/kintree_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ def save_settings(user_settings: dict):
}
user_settings = {**user_settings, **new_settings}
config_interface.dump_file(user_settings, settings.CONFIG_DIGIKEY_API)
digikey_api.setup_environment(force=True)

if api_event == sg.WIN_CLOSED:
search_api_window.close()
Expand Down
6 changes: 3 additions & 3 deletions kintree/search/digikey_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

def disable_api_logger():
# Digi-Key API logger
logging.getLogger('digikey.v3.api').setLevel(logging.WARNING)
logging.getLogger('digikey.v3.api').setLevel(logging.CRITICAL)
# Disable DEBUG
logging.disable(logging.DEBUG)

Expand All @@ -44,8 +44,8 @@ def check_environment() -> bool:
return True


def setup_environment() -> bool:
if not check_environment():
def setup_environment(force=False) -> bool:
if not check_environment() or force:
# SETUP the Digikey authentication see https://developer.digikey.com/documentation/organization#production
digikey_api_settings = config_interface.load_file(settings.CONFIG_DIGIKEY_API)
os.environ['DIGIKEY_CLIENT_ID'] = digikey_api_settings['DIGIKEY_CLIENT_ID']
Expand Down
2 changes: 1 addition & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ keywords = ["inventree", "kicad", "component", "part", "create"]

[tool.poetry.dependencies]
python = ">=3.7,<3.10"
digikey-api = ">=0.4.0,<1.0"
digikey-api = ">=0.5.0,<1.0"
fuzzywuzzy = ">=0.18.0,<1.0"
inventree = ">=0.2.4,<1.0"
multiprocess = ">=0.70.12.2,<0.71"
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
digikey-api>=0.4.0,<1.0
digikey-api>=0.5.0,<1.0
fuzzywuzzy>=0.18.0,<1.0
inventree>=0.2.4,<1.0
multiprocess>=0.70.12.2,<0.71
Expand Down

0 comments on commit cfa54ba

Please sign in to comment.