Skip to content

Commit

Permalink
Fix get credentials (#90)
Browse files Browse the repository at this point in the history
* update credentials getter

* require pip>=23.2 to avoid an incompatibility of earlier versions with python 3.12
  • Loading branch information
rprimet authored Feb 26, 2024
1 parent a491ac3 commit bc11219
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/catleg/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,13 +211,13 @@ def to_markdown(self) -> str:


def _get_legifrance_credentials(*, raise_if_missing=True):
client_id = settings.get("lf_client_id")
client_secret = settings.get("lf_client_secret")
client_id: str | None = settings.get("lf_client_id")
client_secret: str | None = settings.get("lf_client_secret")

if not LF_TOKEN_REGEX.match(client_id):
if not LF_TOKEN_REGEX.match(client_id or ""):
client_id = None

if not LF_TOKEN_REGEX.match(client_secret):
if not LF_TOKEN_REGEX.match(client_secret or ""):
client_secret = None

if raise_if_missing:
Expand Down
3 changes: 2 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[tox]
requires =
tox>=4
pip>=23.2
env_list = format, type, lint, py{310,311,312}


Expand All @@ -20,7 +21,7 @@ description = run type checks
deps =
mypy>=1.2.0
commands =
mypy {posargs:src}
mypy --check-untyped-defs {posargs:src}

[testenv:format]
description = ensure formatting is correct
Expand Down

0 comments on commit bc11219

Please sign in to comment.