Skip to content

Commit

Permalink
+ impersonate environment config field
Browse files Browse the repository at this point in the history
  • Loading branch information
ALERTua committed Jan 6, 2024
1 parent b09bab1 commit 928a134
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions rozetka/tools/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
DEFAULT_COOKIES = {
'visitor_city': "1",
}
IMPERSONATE = os.getenv('IMPERSONATE', 'chrome110')
BULK_ITEMS_REQUEST_MAX_LENGTH = 60

CALLS_MAX = int(os.getenv('CALLS_MAX', 10))
Expand Down
2 changes: 1 addition & 1 deletion rozetka/tools/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ def get(*args, **kwargs) -> Response:
allowed_codes = kwargs.pop('allowed_codes', [])
sleep_time = constants.GET_RETRY_DELAY_SEC
try:
response = requests.get(*args, timeout=constants.GET_TIMEOUT, impersonate="chrome110", **kwargs)
response = requests.get(*args, timeout=constants.GET_TIMEOUT, impersonate=constants.IMPERSONATE, **kwargs)
except Exception as e:
msg = f"Exception while Requesting {args}: {type(e)} {e}. Retrying"
LOG.error(msg)
Expand Down

0 comments on commit 928a134

Please sign in to comment.