Skip to content

Commit

Permalink
Merge pull request #428 from atlanhq/FT-773
Browse files Browse the repository at this point in the history
FT-773: Add X-Atlan-Client-Origin header to session requests
  • Loading branch information
Aryamanz29 authored Nov 22, 2024
2 parents e06fa20 + 6417dbb commit 52c8cc0
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions pyatlan/client/atlan.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ def get_session():
{
"x-atlan-agent": "sdk",
"x-atlan-agent-id": "python",
"x-atlan-client-origin": "product_sdk",
"User-Agent": f"Atlan-PythonSDK/{VERSION}",
}
)
Expand Down
15 changes: 15 additions & 0 deletions tests/unit/test_client.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# SPDX-License-Identifier: Apache-2.0
# Copyright 2022 Atlan Pte. Ltd.
from importlib.resources import read_text
from json import load, loads
from pathlib import Path
from unittest.mock import DEFAULT, Mock, call, patch
Expand Down Expand Up @@ -2204,3 +2205,17 @@ def test_asset_attribute_none_assignment(self):
assert request_json
assert request_json["attributes"]["certificateStatus"] is None
assert request_json["attributes"]["certificateStatusMessage"] is None


def test_atlan_client_headers(client: AtlanClient):
VERSION = read_text("pyatlan", "version.txt").strip()
expected = {
"User-Agent": f"Atlan-PythonSDK/{VERSION}",
"Accept-Encoding": "gzip, deflate",
"Accept": "*/*",
"Connection": "keep-alive",
"x-atlan-agent": "sdk",
"x-atlan-agent-id": "python",
"x-atlan-client-origin": "product_sdk",
}
assert expected == client._session.headers

0 comments on commit 52c8cc0

Please sign in to comment.