Skip to content
This repository was archived by the owner on Sep 1, 2021. It is now read-only.

Commit 5094318

Browse files
authored
Merge pull request #14 from JasonStoltz/headers
Updated reporting headers
2 parents ea65a52 + 3a9c3d7 commit 5094318

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

swiftype_app_search/__version__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
__title__ = 'swiftype_app_search'
22
__description__ = 'An API client for Swiftype App Search'
33
__url__ = 'https://github.com/swiftype/swiftype-app-search-python'
4-
__version__ = '0.2.0'
4+
__version__ = '0.3.0'
55
__author__ = 'Swiftype'
66
__author_email__ = 'eng@swiftype.com'

swiftype_app_search/swiftype_request_session.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ def __init__(self, api_key, base_url):
1212

1313
headers = {
1414
'Authorization': "Bearer {}".format(api_key),
15-
'User-Agent': "swiftype-app-search-python/{}".format(swiftype_app_search.__version__),
15+
'X-Swiftype-Client': 'swiftype-app-search-python',
16+
'X-Swiftype-Client-Version': swiftype_app_search.__version__,
1617
'content-type': 'application/json; charset=utf8'
1718
}
1819
self.session.headers.update(headers)

tests/test_swiftype_request_session.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,15 @@ def test_headers_initialization(self):
2828
headers_to_check = {
2929
k: v
3030
for k, v in iteritems(self.swiftype_session.session.headers)
31-
if k in ['Authorization', 'User-Agent']
31+
if k in ['Authorization', 'X-Swiftype-Client', 'X-Swiftype-Client-Version']
3232
}
3333
version = swiftype_app_search.__version__
3434
self.assertEqual(
3535
headers_to_check,
3636
{
3737
'Authorization': 'Bearer {}'.format(self.api_host_key),
38-
'User-Agent': 'swiftype-app-search-python/{}'.format(version)
38+
'X-Swiftype-Client': 'swiftype-app-search-python',
39+
'X-Swiftype-Client-Version': version
3940
}
4041
)
4142

0 commit comments

Comments
 (0)