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

Commit 475c330

Browse files
authored
Merge pull request #5 from swiftype/bmcgue/ENG-1037-jwt_api_key_name
Use api key names for signed search keys rather than ids
2 parents c6d1130 + f8b2164 commit 475c330

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

README.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,6 @@ Creating a search key that will only search over the body field.
145145
.. code-block:: python
146146
147147
>>> api_key = 'api-mu75psc5egt9ppzuycnc2mc3'
148-
>>> api_key_id = '42'
149-
>>> signed_search_key = Client.create_signed_search_key(api_key, api_key_id, {'search_fields': { 'body': {}}})
148+
>>> api_key_name = 'my-api-token'
149+
>>> signed_search_key = Client.create_signed_search_key(api_key, api_key_name, {'search_fields': { 'body': {}}})
150150
>>> client = Client(account_host_key, signed_search_key)

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.1.1'
4+
__version__ = '0.1.2'
55
__author__ = 'Swiftype'
66
__author_email__ = 'eng@swiftype.com'

swiftype_app_search/client.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,15 +127,15 @@ def search(self, engine_name, query, options=None):
127127
return self.swiftype_session.request('get', endpoint, json=options)
128128

129129
@staticmethod
130-
def create_signed_search_key(api_key, api_key_id, options):
130+
def create_signed_search_key(api_key, api_key_name, options):
131131
"""
132132
Creates a signed API key that will overwrite all search options (except
133133
filters) made with this key.
134134
135135
:param api_key: An API key to use for this client.
136-
:param api_token_id: A unique API Key identifier
136+
:param api_key_name: The unique name for the API Key
137137
:param options: Search options to override.
138138
:return: A JWT signed api token.
139139
"""
140-
options['api_key_id'] = api_key_id
140+
options['api_key_name'] = api_key_name
141141
return jwt.encode(options, api_key, algorithm=Client.SIGNED_SEARCH_TOKEN_JWT_ALGORITHM)

0 commit comments

Comments
 (0)