Coverage for fingerprint_pro_server_api_sdk/api/fingerprint_api.py: 90%
296 statements
« prev ^ index » next coverage.py v7.7.0, created at 2025-03-17 15:34 +0000
« prev ^ index » next coverage.py v7.7.0, created at 2025-03-17 15:34 +0000
1# coding: utf-8
3"""
4 Fingerprint Pro Server API
6 Fingerprint Pro Server API allows you to get information about visitors and about individual events in a server environment. It can be used for data exports, decision-making, and data analysis scenarios. Server API is intended for server-side usage, it's not intended to be used from the client side, whether it's a browser or a mobile device. # noqa: E501
8 OpenAPI spec version: 3
9 Contact: support@fingerprint.com
10 Generated by: https://github.com/swagger-api/swagger-codegen.git
11"""
13import re # noqa: F401
14from multiprocessing import Pool
15from multiprocessing.pool import ApplyResult as AsyncResult
16from typing import Optional, Union
18from fingerprint_pro_server_api_sdk.configuration import Configuration
19from fingerprint_pro_server_api_sdk.api_client import ApiClient
20from fingerprint_pro_server_api_sdk.extend_exception import extend_exception
21from fingerprint_pro_server_api_sdk.rest import ApiException
22from fingerprint_pro_server_api_sdk.models.error_plain_response import ErrorPlainResponse # noqa: F401
23from fingerprint_pro_server_api_sdk.models.error_response import ErrorResponse # noqa: F401
24from fingerprint_pro_server_api_sdk.models.events_get_response import EventsGetResponse # noqa: F401
25from fingerprint_pro_server_api_sdk.models.events_update_request import EventsUpdateRequest # noqa: F401
26from fingerprint_pro_server_api_sdk.models.related_visitors_response import RelatedVisitorsResponse # noqa: F401
27from fingerprint_pro_server_api_sdk.models.search_events_response import SearchEventsResponse # noqa: F401
28from fingerprint_pro_server_api_sdk.models.visitors_get_response import VisitorsGetResponse # noqa: F401
31class FingerprintApi:
32 """NOTE: This class is auto generated by the swagger code generator program.
34 Do not edit the class manually.
35 Ref: https://github.com/swagger-api/swagger-codegen
36 """
38 def __init__(self, configuration: Optional[Configuration] = None, pool: Optional[Pool] = None):
39 if configuration is None:
40 raise ValueError("Missing the required parameter `configuration` when calling `FingerprintApi`") # noqa: E501
41 self.api_client = ApiClient(configuration, pool=pool)
43 def delete_visitor_data(self, visitor_id: str, **kwargs) -> Union[None, AsyncResult[None]]: # noqa: E501
44 """Delete data by visitor ID # noqa: E501
46 Request deleting all data associated with the specified visitor ID. This API is useful for compliance with privacy regulations. ### Which data is deleted? - Browser (or device) properties - Identification requests made from this browser (or device) #### Browser (or device) properties - Represents the data that Fingerprint collected from this specific browser (or device) and everything inferred and derived from it. - Upon request to delete, this data is deleted asynchronously (typically within a few minutes) and it will no longer be used to identify this browser (or device) for your [Fingerprint Application](https://dev.fingerprint.com/docs/glossary#fingerprint-application). #### Identification requests made from this browser (or device) - Fingerprint stores the identification requests made from a browser (or device) for up to 30 (or 90) days depending on your plan. To learn more, see [Data Retention](https://dev.fingerprint.com/docs/regions#data-retention). - Upon request to delete, the identification requests that were made by this browser - Within the past 10 days are deleted within 24 hrs. - Outside of 10 days are allowed to purge as per your data retention period. ### Corollary After requesting to delete a visitor ID, - If the same browser (or device) requests to identify, it will receive a different visitor ID. - If you request [`/events` API](https://dev.fingerprint.com/reference/getevent) with a `request_id` that was made outside of the 10 days, you will still receive a valid response. - If you request [`/visitors` API](https://dev.fingerprint.com/reference/getvisits) for the deleted visitor ID, the response will include identification requests that were made outside of those 10 days. ### Interested? Please [contact our support team](https://fingerprint.com/support/) to enable it for you. Otherwise, you will receive a 403. # noqa: E501
47 This method makes a synchronous HTTP request by default. To make an
48 asynchronous HTTP request, please pass async_req=True
49 >>> thread = api.delete_visitor_data(visitor_id, async_req=True)
50 >>> result = thread.get()
52 :param async_req bool
53 :param visitor_id: The [visitor ID](https://dev.fingerprint.com/reference/get-function#visitorid) you want to delete. (required)
54 :return: None
55 If the method is called asynchronously,
56 returns the request thread.
57 """
58 kwargs['_return_http_data_only'] = True
59 if kwargs.get('async_req'):
60 return self.delete_visitor_data_with_http_info(visitor_id, **kwargs) # noqa: E501
61 else:
62 (data) = self.delete_visitor_data_with_http_info(visitor_id, **kwargs) # noqa: E501
63 return data
65 def delete_visitor_data_with_http_info(self, visitor_id: str, **kwargs): # noqa: E501
66 """Delete data by visitor ID # noqa: E501
68 Request deleting all data associated with the specified visitor ID. This API is useful for compliance with privacy regulations. ### Which data is deleted? - Browser (or device) properties - Identification requests made from this browser (or device) #### Browser (or device) properties - Represents the data that Fingerprint collected from this specific browser (or device) and everything inferred and derived from it. - Upon request to delete, this data is deleted asynchronously (typically within a few minutes) and it will no longer be used to identify this browser (or device) for your [Fingerprint Application](https://dev.fingerprint.com/docs/glossary#fingerprint-application). #### Identification requests made from this browser (or device) - Fingerprint stores the identification requests made from a browser (or device) for up to 30 (or 90) days depending on your plan. To learn more, see [Data Retention](https://dev.fingerprint.com/docs/regions#data-retention). - Upon request to delete, the identification requests that were made by this browser - Within the past 10 days are deleted within 24 hrs. - Outside of 10 days are allowed to purge as per your data retention period. ### Corollary After requesting to delete a visitor ID, - If the same browser (or device) requests to identify, it will receive a different visitor ID. - If you request [`/events` API](https://dev.fingerprint.com/reference/getevent) with a `request_id` that was made outside of the 10 days, you will still receive a valid response. - If you request [`/visitors` API](https://dev.fingerprint.com/reference/getvisits) for the deleted visitor ID, the response will include identification requests that were made outside of those 10 days. ### Interested? Please [contact our support team](https://fingerprint.com/support/) to enable it for you. Otherwise, you will receive a 403. # noqa: E501
69 This method makes a synchronous HTTP request by default. To make an
70 asynchronous HTTP request, please pass async_req=True
71 >>> thread = api.delete_visitor_data_with_http_info(visitor_id, async_req=True)
72 >>> result = thread.get()
74 :param async_req bool
75 :param str visitor_id: The [visitor ID](https://dev.fingerprint.com/reference/get-function#visitorid) you want to delete. (required)
76 :return: None
77 If the method is called asynchronously,
78 returns the request thread.
79 """
81 all_params = [
82 'visitor_id',
83 'async_req',
84 '_return_http_data_only',
85 '_preload_content',
86 '_request_timeout']
88 params = locals()
89 for key, val in params['kwargs'].items():
90 if key not in all_params:
91 raise TypeError(
92 "Got an unexpected keyword argument '%s'"
93 " to method delete_visitor_data" % key
94 )
95 params[key] = val
96 del params['kwargs']
97 # verify the required parameter 'visitor_id' is set
98 if 'visitor_id' not in params or params['visitor_id'] is None:
99 raise ValueError("Missing the required parameter `visitor_id` when calling `delete_visitor_data`") # noqa: E501
101 collection_formats = {}
103 path_params = {}
104 if 'visitor_id' in params:
105 path_params['visitor_id'] = params['visitor_id'] # noqa: E501
107 query_params = [('ii', 'fingerprint-pro-server-python-sdk/8.4.0')]
109 header_params = {}
111 form_params = []
112 local_var_files = {}
114 body_params = None
115 # HTTP header `Accept`
116 header_params['Accept'] = self.api_client.select_header_accept(
117 ['application/json']) # noqa: E501
119 # Authentication setting
120 auth_settings = ['ApiKeyHeader', 'ApiKeyQuery'] # noqa: E501
122 try:
123 return self.api_client.call_api(
124 '/visitors/{visitor_id}', 'DELETE',
125 path_params,
126 query_params,
127 header_params,
128 body=body_params,
129 post_params=form_params,
130 files=local_var_files,
131 response_type=None, # noqa: E501
132 auth_settings=auth_settings,
133 async_req=params.get('async_req'),
134 _return_http_data_only=params.get('_return_http_data_only'),
135 _preload_content=params.get('_preload_content', True),
136 _request_timeout=params.get('_request_timeout'),
137 collection_formats=collection_formats)
138 except ApiException as e:
139 if e.status == 400:
140 error = self.api_client.deserialize(e, 'ErrorResponse', True)
141 raise extend_exception(e, error)
142 if e.status == 403:
143 error = self.api_client.deserialize(e, 'ErrorResponse', True)
144 raise extend_exception(e, error)
145 if e.status == 404:
146 error = self.api_client.deserialize(e, 'ErrorResponse', True)
147 raise extend_exception(e, error)
148 if e.status == 429:
149 error = self.api_client.deserialize(e, 'ErrorResponse', True)
150 raise extend_exception(e, error)
151 raise e
153 def get_event(self, request_id: str, **kwargs) -> Union[EventsGetResponse, AsyncResult[EventsGetResponse]]: # noqa: E501
154 """Get event by request ID # noqa: E501
156 Get a detailed analysis of an individual identification event, including Smart Signals. Please note that the response includes mobile signals (e.g. `rootApps`) even if the request originated from a non-mobile platform. It is highly recommended that you **ignore** the mobile signals for such requests. Use `requestId` as the URL path parameter. This API method is scoped to a request, i.e. all returned information is by `requestId`. # noqa: E501
157 This method makes a synchronous HTTP request by default. To make an
158 asynchronous HTTP request, please pass async_req=True
159 >>> thread = api.get_event(request_id, async_req=True)
160 >>> result = thread.get()
162 :param async_req bool
163 :param request_id: The unique [identifier](https://dev.fingerprint.com/reference/get-function#requestid) of each identification request. (required)
164 :return: EventsGetResponse
165 If the method is called asynchronously,
166 returns the request thread.
167 """
168 kwargs['_return_http_data_only'] = True
169 if kwargs.get('async_req'):
170 return self.get_event_with_http_info(request_id, **kwargs) # noqa: E501
171 else:
172 (data) = self.get_event_with_http_info(request_id, **kwargs) # noqa: E501
173 return data
175 def get_event_with_http_info(self, request_id: str, **kwargs): # noqa: E501
176 """Get event by request ID # noqa: E501
178 Get a detailed analysis of an individual identification event, including Smart Signals. Please note that the response includes mobile signals (e.g. `rootApps`) even if the request originated from a non-mobile platform. It is highly recommended that you **ignore** the mobile signals for such requests. Use `requestId` as the URL path parameter. This API method is scoped to a request, i.e. all returned information is by `requestId`. # noqa: E501
179 This method makes a synchronous HTTP request by default. To make an
180 asynchronous HTTP request, please pass async_req=True
181 >>> thread = api.get_event_with_http_info(request_id, async_req=True)
182 >>> result = thread.get()
184 :param async_req bool
185 :param str request_id: The unique [identifier](https://dev.fingerprint.com/reference/get-function#requestid) of each identification request. (required)
186 :return: EventsGetResponse
187 If the method is called asynchronously,
188 returns the request thread.
189 """
191 all_params = [
192 'request_id',
193 'async_req',
194 '_return_http_data_only',
195 '_preload_content',
196 '_request_timeout']
198 params = locals()
199 for key, val in params['kwargs'].items():
200 if key not in all_params:
201 raise TypeError(
202 "Got an unexpected keyword argument '%s'"
203 " to method get_event" % key
204 )
205 params[key] = val
206 del params['kwargs']
207 # verify the required parameter 'request_id' is set
208 if 'request_id' not in params or params['request_id'] is None:
209 raise ValueError("Missing the required parameter `request_id` when calling `get_event`") # noqa: E501
211 collection_formats = {}
213 path_params = {}
214 if 'request_id' in params:
215 path_params['request_id'] = params['request_id'] # noqa: E501
217 query_params = [('ii', 'fingerprint-pro-server-python-sdk/8.4.0')]
219 header_params = {}
221 form_params = []
222 local_var_files = {}
224 body_params = None
225 # HTTP header `Accept`
226 header_params['Accept'] = self.api_client.select_header_accept(
227 ['application/json']) # noqa: E501
229 # Authentication setting
230 auth_settings = ['ApiKeyHeader', 'ApiKeyQuery'] # noqa: E501
232 try:
233 return self.api_client.call_api(
234 '/events/{request_id}', 'GET',
235 path_params,
236 query_params,
237 header_params,
238 body=body_params,
239 post_params=form_params,
240 files=local_var_files,
241 response_type='EventsGetResponse', # noqa: E501
242 auth_settings=auth_settings,
243 async_req=params.get('async_req'),
244 _return_http_data_only=params.get('_return_http_data_only'),
245 _preload_content=params.get('_preload_content', True),
246 _request_timeout=params.get('_request_timeout'),
247 collection_formats=collection_formats)
248 except ApiException as e:
249 if e.status == 403:
250 error = self.api_client.deserialize(e, 'ErrorResponse', True)
251 raise extend_exception(e, error)
252 if e.status == 404:
253 error = self.api_client.deserialize(e, 'ErrorResponse', True)
254 raise extend_exception(e, error)
255 raise e
257 def get_related_visitors(self, visitor_id: str, **kwargs) -> Union[RelatedVisitorsResponse, AsyncResult[RelatedVisitorsResponse]]: # noqa: E501
258 """Get Related Visitors # noqa: E501
260 Related visitors API lets you link web visits and in-app browser visits that originated from the same mobile device. It searches the past 6 months of identification events to find the visitor IDs that belong to the same mobile device as the given visitor ID. ⚠️ Please note that this API is not enabled by default and is billable separately. ⚠️ If you would like to use Related visitors API, please contact our [support team](https://fingerprint.com/support). To learn more, see [Related visitors API reference](https://dev.fingerprint.com/reference/related-visitors-api). # noqa: E501
261 This method makes a synchronous HTTP request by default. To make an
262 asynchronous HTTP request, please pass async_req=True
263 >>> thread = api.get_related_visitors(visitor_id, async_req=True)
264 >>> result = thread.get()
266 :param async_req bool
267 :param visitor_id: The [visitor ID](https://dev.fingerprint.com/reference/get-function#visitorid) for which you want to find the other visitor IDs that originated from the same mobile device. (required)
268 :return: RelatedVisitorsResponse
269 If the method is called asynchronously,
270 returns the request thread.
271 """
272 kwargs['_return_http_data_only'] = True
273 if kwargs.get('async_req'):
274 return self.get_related_visitors_with_http_info(visitor_id, **kwargs) # noqa: E501
275 else:
276 (data) = self.get_related_visitors_with_http_info(visitor_id, **kwargs) # noqa: E501
277 return data
279 def get_related_visitors_with_http_info(self, visitor_id: str, **kwargs): # noqa: E501
280 """Get Related Visitors # noqa: E501
282 Related visitors API lets you link web visits and in-app browser visits that originated from the same mobile device. It searches the past 6 months of identification events to find the visitor IDs that belong to the same mobile device as the given visitor ID. ⚠️ Please note that this API is not enabled by default and is billable separately. ⚠️ If you would like to use Related visitors API, please contact our [support team](https://fingerprint.com/support). To learn more, see [Related visitors API reference](https://dev.fingerprint.com/reference/related-visitors-api). # noqa: E501
283 This method makes a synchronous HTTP request by default. To make an
284 asynchronous HTTP request, please pass async_req=True
285 >>> thread = api.get_related_visitors_with_http_info(visitor_id, async_req=True)
286 >>> result = thread.get()
288 :param async_req bool
289 :param str visitor_id: The [visitor ID](https://dev.fingerprint.com/reference/get-function#visitorid) for which you want to find the other visitor IDs that originated from the same mobile device. (required)
290 :return: RelatedVisitorsResponse
291 If the method is called asynchronously,
292 returns the request thread.
293 """
295 all_params = [
296 'visitor_id',
297 'async_req',
298 '_return_http_data_only',
299 '_preload_content',
300 '_request_timeout']
302 params = locals()
303 for key, val in params['kwargs'].items():
304 if key not in all_params:
305 raise TypeError(
306 "Got an unexpected keyword argument '%s'"
307 " to method get_related_visitors" % key
308 )
309 params[key] = val
310 del params['kwargs']
311 # verify the required parameter 'visitor_id' is set
312 if 'visitor_id' not in params or params['visitor_id'] is None:
313 raise ValueError("Missing the required parameter `visitor_id` when calling `get_related_visitors`") # noqa: E501
315 collection_formats = {}
317 path_params = {}
319 query_params = [('ii', 'fingerprint-pro-server-python-sdk/8.4.0')]
320 if 'visitor_id' in params:
321 query_params.append(('visitor_id', params['visitor_id'])) # noqa: E501
323 header_params = {}
325 form_params = []
326 local_var_files = {}
328 body_params = None
329 # HTTP header `Accept`
330 header_params['Accept'] = self.api_client.select_header_accept(
331 ['application/json']) # noqa: E501
333 # Authentication setting
334 auth_settings = ['ApiKeyHeader', 'ApiKeyQuery'] # noqa: E501
336 try:
337 return self.api_client.call_api(
338 '/related-visitors', 'GET',
339 path_params,
340 query_params,
341 header_params,
342 body=body_params,
343 post_params=form_params,
344 files=local_var_files,
345 response_type='RelatedVisitorsResponse', # noqa: E501
346 auth_settings=auth_settings,
347 async_req=params.get('async_req'),
348 _return_http_data_only=params.get('_return_http_data_only'),
349 _preload_content=params.get('_preload_content', True),
350 _request_timeout=params.get('_request_timeout'),
351 collection_formats=collection_formats)
352 except ApiException as e:
353 if e.status == 400:
354 error = self.api_client.deserialize(e, 'ErrorResponse', True)
355 raise extend_exception(e, error)
356 if e.status == 403:
357 error = self.api_client.deserialize(e, 'ErrorResponse', True)
358 raise extend_exception(e, error)
359 if e.status == 404:
360 error = self.api_client.deserialize(e, 'ErrorResponse', True)
361 raise extend_exception(e, error)
362 if e.status == 429:
363 error = self.api_client.deserialize(e, 'ErrorResponse', True)
364 raise extend_exception(e, error)
365 raise e
367 def get_visits(self, visitor_id: str, **kwargs) -> Union[VisitorsGetResponse, AsyncResult[VisitorsGetResponse]]: # noqa: E501
368 """Get visits by visitor ID # noqa: E501
370 Get a history of visits (identification events) for a specific `visitorId`. Use the `visitorId` as a URL path parameter. Only information from the _Identification_ product is returned. #### Headers * `Retry-After` — Present in case of `429 Too many requests`. Indicates how long you should wait before making a follow-up request. The value is non-negative decimal integer indicating the seconds to delay after the response is received. # noqa: E501
371 This method makes a synchronous HTTP request by default. To make an
372 asynchronous HTTP request, please pass async_req=True
373 >>> thread = api.get_visits(visitor_id, async_req=True)
374 >>> result = thread.get()
376 :param async_req bool
377 :param visitor_id: Unique [visitor identifier](https://dev.fingerprint.com/reference/get-function#visitorid) issued by Fingerprint Pro. (required)
378 :param request_id: Filter visits by `requestId`. Every identification request has a unique identifier associated with it called `requestId`. This identifier is returned to the client in the identification [result](https://dev.fingerprint.com/reference/get-function#requestid). When you filter visits by `requestId`, only one visit will be returned.
379 :param linked_id: Filter visits by your custom identifier. You can use [`linkedId`](https://dev.fingerprint.com/reference/get-function#linkedid) to associate identification requests with your own identifier, for example: session ID, purchase ID, or transaction ID. You can then use this `linked_id` parameter to retrieve all events associated with your custom identifier.
380 :param limit: Limit scanned results. For performance reasons, the API first scans some number of events before filtering them. Use `limit` to specify how many events are scanned before they are filtered by `requestId` or `linkedId`. Results are always returned sorted by the timestamp (most recent first). By default, the most recent 100 visits are scanned, the maximum is 500.
381 :param pagination_key: Use `paginationKey` to get the next page of results. When more results are available (e.g., you requested 200 results using `limit` parameter, but a total of 600 results are available), the `paginationKey` top-level attribute is added to the response. The key corresponds to the `requestId` of the last returned event. In the following request, use that value in the `paginationKey` parameter to get the next page of results: 1. First request, returning most recent 200 events: `GET api-base-url/visitors/:visitorId?limit=200` 2. Use `response.paginationKey` to get the next page of results: `GET api-base-url/visitors/:visitorId?limit=200&paginationKey=1683900801733.Ogvu1j` Pagination happens during scanning and before filtering, so you can get less visits than the `limit` you specified with more available on the next page. When there are no more results available for scanning, the `paginationKey` attribute is not returned.
382 :param before: ⚠️ Deprecated pagination method, please use `paginationKey` instead. Timestamp (in milliseconds since epoch) used to paginate results.
383 :return: VisitorsGetResponse
384 If the method is called asynchronously,
385 returns the request thread.
386 """
387 kwargs['_return_http_data_only'] = True
388 if kwargs.get('async_req'):
389 return self.get_visits_with_http_info(visitor_id, **kwargs) # noqa: E501
390 else:
391 (data) = self.get_visits_with_http_info(visitor_id, **kwargs) # noqa: E501
392 return data
394 def get_visits_with_http_info(self, visitor_id: str, **kwargs): # noqa: E501
395 """Get visits by visitor ID # noqa: E501
397 Get a history of visits (identification events) for a specific `visitorId`. Use the `visitorId` as a URL path parameter. Only information from the _Identification_ product is returned. #### Headers * `Retry-After` — Present in case of `429 Too many requests`. Indicates how long you should wait before making a follow-up request. The value is non-negative decimal integer indicating the seconds to delay after the response is received. # noqa: E501
398 This method makes a synchronous HTTP request by default. To make an
399 asynchronous HTTP request, please pass async_req=True
400 >>> thread = api.get_visits_with_http_info(visitor_id, async_req=True)
401 >>> result = thread.get()
403 :param async_req bool
404 :param str visitor_id: Unique [visitor identifier](https://dev.fingerprint.com/reference/get-function#visitorid) issued by Fingerprint Pro. (required)
405 :param str request_id: Filter visits by `requestId`. Every identification request has a unique identifier associated with it called `requestId`. This identifier is returned to the client in the identification [result](https://dev.fingerprint.com/reference/get-function#requestid). When you filter visits by `requestId`, only one visit will be returned.
406 :param str linked_id: Filter visits by your custom identifier. You can use [`linkedId`](https://dev.fingerprint.com/reference/get-function#linkedid) to associate identification requests with your own identifier, for example: session ID, purchase ID, or transaction ID. You can then use this `linked_id` parameter to retrieve all events associated with your custom identifier.
407 :param int limit: Limit scanned results. For performance reasons, the API first scans some number of events before filtering them. Use `limit` to specify how many events are scanned before they are filtered by `requestId` or `linkedId`. Results are always returned sorted by the timestamp (most recent first). By default, the most recent 100 visits are scanned, the maximum is 500.
408 :param str pagination_key: Use `paginationKey` to get the next page of results. When more results are available (e.g., you requested 200 results using `limit` parameter, but a total of 600 results are available), the `paginationKey` top-level attribute is added to the response. The key corresponds to the `requestId` of the last returned event. In the following request, use that value in the `paginationKey` parameter to get the next page of results: 1. First request, returning most recent 200 events: `GET api-base-url/visitors/:visitorId?limit=200` 2. Use `response.paginationKey` to get the next page of results: `GET api-base-url/visitors/:visitorId?limit=200&paginationKey=1683900801733.Ogvu1j` Pagination happens during scanning and before filtering, so you can get less visits than the `limit` you specified with more available on the next page. When there are no more results available for scanning, the `paginationKey` attribute is not returned.
409 :param int before: ⚠️ Deprecated pagination method, please use `paginationKey` instead. Timestamp (in milliseconds since epoch) used to paginate results.
410 :return: VisitorsGetResponse
411 If the method is called asynchronously,
412 returns the request thread.
413 """
415 all_params = [
416 'visitor_id',
417 'request_id',
418 'linked_id',
419 'limit',
420 'pagination_key',
421 'before',
422 'async_req',
423 '_return_http_data_only',
424 '_preload_content',
425 '_request_timeout']
427 params = locals()
428 for key, val in params['kwargs'].items():
429 if key not in all_params:
430 raise TypeError(
431 "Got an unexpected keyword argument '%s'"
432 " to method get_visits" % key
433 )
434 params[key] = val
435 del params['kwargs']
436 # verify the required parameter 'visitor_id' is set
437 if 'visitor_id' not in params or params['visitor_id'] is None:
438 raise ValueError("Missing the required parameter `visitor_id` when calling `get_visits`") # noqa: E501
440 collection_formats = {}
442 path_params = {}
443 if 'visitor_id' in params:
444 path_params['visitor_id'] = params['visitor_id'] # noqa: E501
446 query_params = [('ii', 'fingerprint-pro-server-python-sdk/8.4.0')]
447 if 'request_id' in params:
448 query_params.append(('request_id', params['request_id'])) # noqa: E501
449 if 'linked_id' in params:
450 query_params.append(('linked_id', params['linked_id'])) # noqa: E501
451 if 'limit' in params:
452 query_params.append(('limit', params['limit'])) # noqa: E501
453 if 'pagination_key' in params:
454 query_params.append(('paginationKey', params['pagination_key'])) # noqa: E501
455 if 'before' in params:
456 query_params.append(('before', params['before'])) # noqa: E501
458 header_params = {}
460 form_params = []
461 local_var_files = {}
463 body_params = None
464 # HTTP header `Accept`
465 header_params['Accept'] = self.api_client.select_header_accept(
466 ['application/json']) # noqa: E501
468 # Authentication setting
469 auth_settings = ['ApiKeyHeader', 'ApiKeyQuery'] # noqa: E501
471 try:
472 return self.api_client.call_api(
473 '/visitors/{visitor_id}', 'GET',
474 path_params,
475 query_params,
476 header_params,
477 body=body_params,
478 post_params=form_params,
479 files=local_var_files,
480 response_type='VisitorsGetResponse', # noqa: E501
481 auth_settings=auth_settings,
482 async_req=params.get('async_req'),
483 _return_http_data_only=params.get('_return_http_data_only'),
484 _preload_content=params.get('_preload_content', True),
485 _request_timeout=params.get('_request_timeout'),
486 collection_formats=collection_formats)
487 except ApiException as e:
488 if e.status == 400:
489 error = self.api_client.deserialize(e, 'ErrorPlainResponse', True)
490 raise extend_exception(e, error)
491 if e.status == 403:
492 error = self.api_client.deserialize(e, 'ErrorPlainResponse', True)
493 raise extend_exception(e, error)
494 if e.status == 429:
495 error = self.api_client.deserialize(e, 'ErrorPlainResponse', True)
496 raise extend_exception(e, error)
497 raise e
499 def search_events(self, limit: int, **kwargs) -> Union[SearchEventsResponse, AsyncResult[SearchEventsResponse]]: # noqa: E501
500 """Get events via search # noqa: E501
502 Search for identification events, including Smart Signals, using multiple filtering criteria. If you don't provide `start` or `end` parameters, the default search range is the last 7 days. Please note that events include mobile signals (e.g. `rootApps`) even if the request originated from a non-mobile platform. We recommend you **ignore** mobile signals for such requests. # noqa: E501
503 This method makes a synchronous HTTP request by default. To make an
504 asynchronous HTTP request, please pass async_req=True
505 >>> thread = api.search_events(limit, async_req=True)
506 >>> result = thread.get()
508 :param async_req bool
509 :param limit: Limit the number of events returned. (required)
510 :param pagination_key: Use `pagination_key` to get the next page of results. When more results are available (e.g., you requested up to 200 results for your search using `limit`, but there are more than 200 events total matching your request), the `paginationKey` top-level attribute is added to the response. The key corresponds to the `timestamp` of the last returned event. In the following request, use that value in the `pagination_key` parameter to get the next page of results: 1. First request, returning most recent 200 events: `GET api-base-url/events/search?limit=200` 2. Use `response.paginationKey` to get the next page of results: `GET api-base-url/events/search?limit=200&pagination_key=1740815825085`
511 :param visitor_id: Unique [visitor identifier](https://dev.fingerprint.com/reference/get-function#visitorid) issued by Fingerprint Pro. Filter for events matching this `visitor_id`.
512 :param bot: Filter events by the bot detection result, specifically: `all` - events where any kind of bot was detected. `good` - events where a good bot was detected. `bad` - events where a bad bot was detected. `none` - events where no bot was detected.
513 :param ip_address: Filter events by IP address range. The range can be as specific as a single IP (/32 for IPv4 or /128 for IPv6) All ip_address filters must use CIDR notation, for example, 10.0.0.0/24, 192.168.0.1/32
514 :param linked_id: Filter events by your custom identifier. You can use [linked IDs](https://dev.fingerprint.com/reference/get-function#linkedid) to associate identification requests with your own identifier, for example, session ID, purchase ID, or transaction ID. You can then use this `linked_id` parameter to retrieve all events associated with your custom identifier.
515 :param start: Filter events with a timestamp greater than the start time, in Unix time (milliseconds).
516 :param end: Filter events with a timestamp smaller than the end time, in Unix time (milliseconds).
517 :param reverse: Sort events in reverse timestamp order.
518 :param suspect: Filter events previously tagged as suspicious via the [Update API](https://dev.fingerprint.com/reference/updateevent). > Note: When using this parameter, only events with the `suspect` property explicitly set to `true` or `false` are returned. Events with undefined `suspect` property are left out of the response.
519 :return: SearchEventsResponse
520 If the method is called asynchronously,
521 returns the request thread.
522 """
523 kwargs['_return_http_data_only'] = True
524 if kwargs.get('async_req'):
525 return self.search_events_with_http_info(limit, **kwargs) # noqa: E501
526 else:
527 (data) = self.search_events_with_http_info(limit, **kwargs) # noqa: E501
528 return data
530 def search_events_with_http_info(self, limit: int, **kwargs): # noqa: E501
531 """Get events via search # noqa: E501
533 Search for identification events, including Smart Signals, using multiple filtering criteria. If you don't provide `start` or `end` parameters, the default search range is the last 7 days. Please note that events include mobile signals (e.g. `rootApps`) even if the request originated from a non-mobile platform. We recommend you **ignore** mobile signals for such requests. # noqa: E501
534 This method makes a synchronous HTTP request by default. To make an
535 asynchronous HTTP request, please pass async_req=True
536 >>> thread = api.search_events_with_http_info(limit, async_req=True)
537 >>> result = thread.get()
539 :param async_req bool
540 :param int limit: Limit the number of events returned. (required)
541 :param str pagination_key: Use `pagination_key` to get the next page of results. When more results are available (e.g., you requested up to 200 results for your search using `limit`, but there are more than 200 events total matching your request), the `paginationKey` top-level attribute is added to the response. The key corresponds to the `timestamp` of the last returned event. In the following request, use that value in the `pagination_key` parameter to get the next page of results: 1. First request, returning most recent 200 events: `GET api-base-url/events/search?limit=200` 2. Use `response.paginationKey` to get the next page of results: `GET api-base-url/events/search?limit=200&pagination_key=1740815825085`
542 :param str visitor_id: Unique [visitor identifier](https://dev.fingerprint.com/reference/get-function#visitorid) issued by Fingerprint Pro. Filter for events matching this `visitor_id`.
543 :param str bot: Filter events by the bot detection result, specifically: `all` - events where any kind of bot was detected. `good` - events where a good bot was detected. `bad` - events where a bad bot was detected. `none` - events where no bot was detected.
544 :param str ip_address: Filter events by IP address range. The range can be as specific as a single IP (/32 for IPv4 or /128 for IPv6) All ip_address filters must use CIDR notation, for example, 10.0.0.0/24, 192.168.0.1/32
545 :param str linked_id: Filter events by your custom identifier. You can use [linked IDs](https://dev.fingerprint.com/reference/get-function#linkedid) to associate identification requests with your own identifier, for example, session ID, purchase ID, or transaction ID. You can then use this `linked_id` parameter to retrieve all events associated with your custom identifier.
546 :param int start: Filter events with a timestamp greater than the start time, in Unix time (milliseconds).
547 :param int end: Filter events with a timestamp smaller than the end time, in Unix time (milliseconds).
548 :param bool reverse: Sort events in reverse timestamp order.
549 :param bool suspect: Filter events previously tagged as suspicious via the [Update API](https://dev.fingerprint.com/reference/updateevent). > Note: When using this parameter, only events with the `suspect` property explicitly set to `true` or `false` are returned. Events with undefined `suspect` property are left out of the response.
550 :return: SearchEventsResponse
551 If the method is called asynchronously,
552 returns the request thread.
553 """
555 all_params = [
556 'limit',
557 'pagination_key',
558 'visitor_id',
559 'bot',
560 'ip_address',
561 'linked_id',
562 'start',
563 'end',
564 'reverse',
565 'suspect',
566 'async_req',
567 '_return_http_data_only',
568 '_preload_content',
569 '_request_timeout']
571 params = locals()
572 for key, val in params['kwargs'].items():
573 if key not in all_params:
574 raise TypeError(
575 "Got an unexpected keyword argument '%s'"
576 " to method search_events" % key
577 )
578 params[key] = val
579 del params['kwargs']
580 # verify the required parameter 'limit' is set
581 if 'limit' not in params or params['limit'] is None:
582 raise ValueError("Missing the required parameter `limit` when calling `search_events`") # noqa: E501
584 collection_formats = {}
586 path_params = {}
588 query_params = [('ii', 'fingerprint-pro-server-python-sdk/8.4.0')]
589 if 'limit' in params:
590 query_params.append(('limit', params['limit'])) # noqa: E501
591 if 'pagination_key' in params:
592 query_params.append(('pagination_key', params['pagination_key'])) # noqa: E501
593 if 'visitor_id' in params:
594 query_params.append(('visitor_id', params['visitor_id'])) # noqa: E501
595 if 'bot' in params:
596 query_params.append(('bot', params['bot'])) # noqa: E501
597 if 'ip_address' in params:
598 query_params.append(('ip_address', params['ip_address'])) # noqa: E501
599 if 'linked_id' in params:
600 query_params.append(('linked_id', params['linked_id'])) # noqa: E501
601 if 'start' in params:
602 query_params.append(('start', params['start'])) # noqa: E501
603 if 'end' in params:
604 query_params.append(('end', params['end'])) # noqa: E501
605 if 'reverse' in params:
606 query_params.append(('reverse', params['reverse'])) # noqa: E501
607 if 'suspect' in params:
608 query_params.append(('suspect', params['suspect'])) # noqa: E501
610 header_params = {}
612 form_params = []
613 local_var_files = {}
615 body_params = None
616 # HTTP header `Accept`
617 header_params['Accept'] = self.api_client.select_header_accept(
618 ['application/json']) # noqa: E501
620 # Authentication setting
621 auth_settings = ['ApiKeyHeader', 'ApiKeyQuery'] # noqa: E501
623 try:
624 return self.api_client.call_api(
625 '/events/search', 'GET',
626 path_params,
627 query_params,
628 header_params,
629 body=body_params,
630 post_params=form_params,
631 files=local_var_files,
632 response_type='SearchEventsResponse', # noqa: E501
633 auth_settings=auth_settings,
634 async_req=params.get('async_req'),
635 _return_http_data_only=params.get('_return_http_data_only'),
636 _preload_content=params.get('_preload_content', True),
637 _request_timeout=params.get('_request_timeout'),
638 collection_formats=collection_formats)
639 except ApiException as e:
640 if e.status == 400:
641 error = self.api_client.deserialize(e, 'ErrorResponse', True)
642 raise extend_exception(e, error)
643 if e.status == 403:
644 error = self.api_client.deserialize(e, 'ErrorResponse', True)
645 raise extend_exception(e, error)
646 raise e
648 def update_event(self, body: EventsUpdateRequest, request_id: str, **kwargs) -> Union[None, AsyncResult[None]]: # noqa: E501
649 """Update an event with a given request ID # noqa: E501
651 Change information in existing events specified by `requestId` or *flag suspicious events*. When an event is created, it is assigned `linkedId` and `tag` submitted through the JS agent parameters. This information might not be available on the client so the Server API allows for updating the attributes after the fact. **Warning** It's not possible to update events older than 10 days. # noqa: E501
652 This method makes a synchronous HTTP request by default. To make an
653 asynchronous HTTP request, please pass async_req=True
654 >>> thread = api.update_event(body, request_id, async_req=True)
655 >>> result = thread.get()
657 :param async_req bool
658 :param body: (required)
659 :param request_id: The unique event [identifier](https://dev.fingerprint.com/reference/get-function#requestid). (required)
660 :return: None
661 If the method is called asynchronously,
662 returns the request thread.
663 """
664 kwargs['_return_http_data_only'] = True
665 if kwargs.get('async_req'):
666 return self.update_event_with_http_info(body, request_id, **kwargs) # noqa: E501
667 else:
668 (data) = self.update_event_with_http_info(body, request_id, **kwargs) # noqa: E501
669 return data
671 def update_event_with_http_info(self, body: EventsUpdateRequest, request_id: str, **kwargs): # noqa: E501
672 """Update an event with a given request ID # noqa: E501
674 Change information in existing events specified by `requestId` or *flag suspicious events*. When an event is created, it is assigned `linkedId` and `tag` submitted through the JS agent parameters. This information might not be available on the client so the Server API allows for updating the attributes after the fact. **Warning** It's not possible to update events older than 10 days. # noqa: E501
675 This method makes a synchronous HTTP request by default. To make an
676 asynchronous HTTP request, please pass async_req=True
677 >>> thread = api.update_event_with_http_info(body, request_id, async_req=True)
678 >>> result = thread.get()
680 :param async_req bool
681 :param EventsUpdateRequest body: (required)
682 :param str request_id: The unique event [identifier](https://dev.fingerprint.com/reference/get-function#requestid). (required)
683 :return: None
684 If the method is called asynchronously,
685 returns the request thread.
686 """
688 all_params = [
689 'body',
690 'request_id',
691 'async_req',
692 '_return_http_data_only',
693 '_preload_content',
694 '_request_timeout']
696 params = locals()
697 for key, val in params['kwargs'].items():
698 if key not in all_params:
699 raise TypeError(
700 "Got an unexpected keyword argument '%s'"
701 " to method update_event" % key
702 )
703 params[key] = val
704 del params['kwargs']
705 # verify the required parameter 'body' is set
706 if 'body' not in params or params['body'] is None:
707 raise ValueError("Missing the required parameter `body` when calling `update_event`") # noqa: E501
708 # verify the required parameter 'request_id' is set
709 if 'request_id' not in params or params['request_id'] is None:
710 raise ValueError("Missing the required parameter `request_id` when calling `update_event`") # noqa: E501
712 collection_formats = {}
714 path_params = {}
715 if 'request_id' in params:
716 path_params['request_id'] = params['request_id'] # noqa: E501
718 query_params = [('ii', 'fingerprint-pro-server-python-sdk/8.4.0')]
720 header_params = {}
722 form_params = []
723 local_var_files = {}
725 body_params = None
726 if 'body' in params:
727 body_params = params['body']
728 # HTTP header `Accept`
729 header_params['Accept'] = self.api_client.select_header_accept(
730 ['application/json']) # noqa: E501
732 # HTTP header `Content-Type`
733 header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
734 ['application/json']) # noqa: E501
736 # Authentication setting
737 auth_settings = ['ApiKeyHeader', 'ApiKeyQuery'] # noqa: E501
739 try:
740 return self.api_client.call_api(
741 '/events/{request_id}', 'PUT',
742 path_params,
743 query_params,
744 header_params,
745 body=body_params,
746 post_params=form_params,
747 files=local_var_files,
748 response_type=None, # noqa: E501
749 auth_settings=auth_settings,
750 async_req=params.get('async_req'),
751 _return_http_data_only=params.get('_return_http_data_only'),
752 _preload_content=params.get('_preload_content', True),
753 _request_timeout=params.get('_request_timeout'),
754 collection_formats=collection_formats)
755 except ApiException as e:
756 if e.status == 400:
757 error = self.api_client.deserialize(e, 'ErrorResponse', True)
758 raise extend_exception(e, error)
759 if e.status == 403:
760 error = self.api_client.deserialize(e, 'ErrorResponse', True)
761 raise extend_exception(e, error)
762 if e.status == 404:
763 error = self.api_client.deserialize(e, 'ErrorResponse', True)
764 raise extend_exception(e, error)
765 if e.status == 409:
766 error = self.api_client.deserialize(e, 'ErrorResponse', True)
767 raise extend_exception(e, error)
768 raise e