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

Workaround for #119 #120

Merged
merged 4 commits into from
Jun 26, 2023
Merged
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
6 changes: 4 additions & 2 deletions pyIndego/const.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""Constants for pyIndego."""
from enum import Enum

import random
import string

class Methods(Enum):
"""Enum with HTTP methods."""
Expand All @@ -23,7 +24,8 @@ class Methods(Enum):
CONTENT_TYPE: CONTENT_TYPE_JSON,
# We need to change the user-agent!
# The Microsoft Azure proxy seems to block all requests (HTTP 403) for the default 'python-requests' user-agent.
"User-Agent": "pyIndego"
# We also need to use a random agent for each client: https://github.com/jm-73/pyIndego/issues/119
"User-Agent": ''.join(random.choices(string.ascii_uppercase + string.digits, k=12))
}
DEFAULT_LOOKUP_VALUE = "Not in database."

Expand Down