Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Strip whitespace from keys while loading #3000

Merged
merged 1 commit into from
Feb 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions augur/tasks/github/util/github_api_key_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
import random

from typing import List
from sqlalchemy.orm import Session

Check warning on line 6 in augur/tasks/github/util/github_api_key_handler.py

View workflow job for this annotation

GitHub Actions / runner / pylint

[pylint] reported by reviewdog 🐶 W0611: Unused Session imported from sqlalchemy.orm (unused-import) Raw Output: augur/tasks/github/util/github_api_key_handler.py:6:0: W0611: Unused Session imported from sqlalchemy.orm (unused-import)

from augur.tasks.util.redis_list import RedisList
from augur.application.db.lib import get_value, get_worker_oauth_keys
from sqlalchemy import func

Check warning on line 10 in augur/tasks/github/util/github_api_key_handler.py

View workflow job for this annotation

GitHub Actions / runner / pylint

[pylint] reported by reviewdog 🐶 W0611: Unused func imported from sqlalchemy (unused-import) Raw Output: augur/tasks/github/util/github_api_key_handler.py:10:0: W0611: Unused func imported from sqlalchemy (unused-import)

RATE_LIMIT_URL = "https://api.github.com/rate_limit"

Expand Down Expand Up @@ -98,7 +98,7 @@
try:
keys = self.get_api_keys_from_database()
break
except:

Check warning on line 101 in augur/tasks/github/util/github_api_key_handler.py

View workflow job for this annotation

GitHub Actions / runner / pylint

[pylint] reported by reviewdog 🐶 W0702: No exception type(s) specified (bare-except) Raw Output: augur/tasks/github/util/github_api_key_handler.py:101:12: W0702: No exception type(s) specified (bare-except)
time.sleep(5)
attempts += 1

Expand All @@ -107,6 +107,8 @@

if len(keys) == 0:
return []

keys = [key.strip() for key in keys]

valid_keys = []
with httpx.Client() as client:
Expand Down
2 changes: 2 additions & 0 deletions augur/tasks/gitlab/gitlab_api_key_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@ def get_api_keys(self) -> List[str]:
if len(keys) == 0:
return []

keys = [key.strip() for key in keys]

valid_keys = []
with httpx.Client() as client:

Expand Down
Loading