Skip to content

Commit d828af3

Browse files
committed
Add client header + Remove user agent.
1 parent c4ad458 commit d828af3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+119
-61
lines changed

elastic_site_search/client.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
from .version import VERSION
1717

18-
USER_AGENT = 'Swiftype-Python/' + VERSION
18+
CLIENT_NAME = 'elastic-app-search-python'
1919
DEFAULT_API_HOST = 'api.swiftype.com'
2020
DEFAULT_API_BASE_PATH = '/api/v1/'
2121

@@ -217,8 +217,8 @@ def _put(self, path, params={}, data={}):
217217

218218
def _request(self, method, path, params={}, data={}):
219219
headers = {}
220-
headers['User-Agent'] = USER_AGENT
221-
headers['Content-Type'] = 'application/json'
220+
headers['X-Swiftype-Client'] = CLIENT_NAME
221+
headers['X-Swiftype-Client-Version'] = VERSION
222222
if self.__username is not None and self.__password is not None:
223223
credentials = "%s:%s" % (self.__username, self.__password)
224224
base64_credentials = base64.encodestring(credentials.encode('utf-8')).decode()

fixtures/analytics_autoselects.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ interactions:
33
body: ''
44
headers:
55
Content-Type: [application/json]
6-
User-Agent: [Swiftype-Python/1.0.0]
6+
X-Swiftype-Client: elastic-app-search-python
7+
X-Swiftype-Client-Version: 2.0.0
78
method: GET
89
uri: http://localhost:3000/api/v1/engines/api-test/analytics/autoselects.json?auth_token=a-test-api-key
910
response:

fixtures/analytics_autoselects_pagination.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ interactions:
33
body: ''
44
headers:
55
Content-Type: [application/json]
6-
User-Agent: [Swiftype-Python/1.0.0]
6+
X-Swiftype-Client: elastic-app-search-python
7+
X-Swiftype-Client-Version: 2.0.0
78
method: GET
89
uri: http://localhost:3000/api/v1/engines/api-test/analytics/autoselects.json?auth_token=a-test-api-key&start_date=2013-12-31&end_date=2014-01-01
910
response:

fixtures/analytics_searches.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ interactions:
33
body: ''
44
headers:
55
Content-Type: [application/json]
6-
User-Agent: [Swiftype-Python/1.0.0]
6+
X-Swiftype-Client: elastic-app-search-python
7+
X-Swiftype-Client-Version: 2.0.0
78
method: GET
89
uri: http://localhost:3000/api/v1/engines/api-test/analytics/searches.json?auth_token=a-test-api-key
910
response:

fixtures/analytics_searches_pagination.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ interactions:
33
body: ''
44
headers:
55
Content-Type: [application/json]
6-
User-Agent: [Swiftype-Python/1.0.0]
6+
X-Swiftype-Client: elastic-app-search-python
7+
X-Swiftype-Client-Version: 2.0.0
78
method: GET
89
uri: http://localhost:3000/api/v1/engines/api-test/analytics/searches.json?auth_token=a-test-api-key&start_date=2013-12-31&end_date=2014-01-01
910
response:

fixtures/analytics_top_no_result_queries.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ interactions:
33
body: ''
44
headers:
55
Content-Type: [application/json]
6-
User-Agent: [Swiftype-Python/1.0.0]
6+
X-Swiftype-Client: elastic-app-search-python
7+
X-Swiftype-Client-Version: 2.0.0
78
method: GET
89
uri: http://localhost:3000/api/v1/engines/api-test/analytics/top_no_result_queries_in_range.json?auth_token=a-test-api-key
910
response:

fixtures/analytics_top_no_result_queries_with_dates.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ interactions:
33
body: ''
44
headers:
55
Content-Type: [application/json]
6-
User-Agent: [Swiftype-Python/1.0.0]
6+
X-Swiftype-Client: elastic-app-search-python
7+
X-Swiftype-Client-Version: 2.0.0
78
method: GET
89
uri: http://localhost:3000/api/v1/engines/api-test/analytics/top_no_result_queries_in_range.json?auth_token=a-test-api-key&start_date=2013-12-31&end_date=2014-01-01
910
response:

fixtures/analytics_top_queries.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ interactions:
33
body: ''
44
headers:
55
Content-Type: [application/json]
6-
User-Agent: [Swiftype-Python/1.0.0]
6+
X-Swiftype-Client: elastic-app-search-python
7+
X-Swiftype-Client-Version: 2.0.0
78
method: GET
89
uri: http://localhost:3000/api/v1/engines/api-test/analytics/top_queries.json?auth_token=a-test-api-key
910
response:

fixtures/analytics_top_queries_in_range.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ interactions:
33
body: ''
44
headers:
55
Content-Type: [application/json]
6-
User-Agent: [Swiftype-Python/1.0.0]
6+
X-Swiftype-Client: elastic-app-search-python
7+
X-Swiftype-Client-Version: 2.0.0
78
method: GET
89
uri: http://localhost:3000/api/v1/engines/api-test/analytics/top_queries_in_range.json?auth_token=a-test-api-key&start_date=2013-12-31&end_date=2014-01-01
910
response:

fixtures/analytics_top_queries_pagination.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ interactions:
33
body: ''
44
headers:
55
Content-Type: [application/json]
6-
User-Agent: [Swiftype-Python/1.0.0]
6+
X-Swiftype-Client: elastic-app-search-python
7+
X-Swiftype-Client-Version: 2.0.0
78
method: GET
89
uri: http://localhost:3000/api/v1/engines/api-test/analytics/top_queries.json?per_page=10&auth_token=a-test-api-key&page=2
910
response:

0 commit comments

Comments
 (0)