Skip to content

Commit 1e50374

Browse files
authored
fix: Fix casing in isAtHome in User-Agent header (#903)
To be consistent with the reference JS implementation. Example: `User-Agent: ... isAtHome/True` -> `User-Agent: ... isAtHome/true`
1 parent d9de100 commit 1e50374

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

src/apify_client/http_clients/_base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ def __init__(
129129
if workflow_key is not None:
130130
default_headers['X-Apify-Workflow-Key'] = workflow_key
131131

132-
is_at_home = 'APIFY_IS_AT_HOME' in os.environ
132+
is_at_home = str('APIFY_IS_AT_HOME' in os.environ).lower()
133133
python_version = '.'.join([str(x) for x in sys.version_info[:3]])
134134
client_version = metadata.version('apify-client')
135135

tests/unit/test_client_headers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def _header_handler(request: Request) -> Response:
2828

2929

3030
def _get_user_agent() -> str:
31-
is_at_home = 'APIFY_IS_AT_HOME' in os.environ
31+
is_at_home = str('APIFY_IS_AT_HOME' in os.environ).lower()
3232
python_version = '.'.join([str(x) for x in sys.version_info[:3]])
3333
client_version = metadata.version('apify-client')
3434
return f'ApifyClient/{client_version} ({sys.platform}; Python/{python_version}); isAtHome/{is_at_home}'

0 commit comments

Comments
 (0)