Coverage for fingerprint_pro_server_api_sdk/api/fingerprint_api.py: 89%

294 statements  

« prev     ^ index     » next       coverage.py v7.6.12, created at 2025-02-21 15:03 +0000

1# coding: utf-8 

2 

3""" 

4 Fingerprint Pro Server API 

5 

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 

7 

8 OpenAPI spec version: 3 

9 Contact: support@fingerprint.com 

10 Generated by: https://github.com/swagger-api/swagger-codegen.git 

11""" 

12 

13import re # noqa: F401 

14from multiprocessing import Pool 

15from multiprocessing.pool import ApplyResult as AsyncResult 

16from typing import Optional, Union 

17 

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 

29 

30 

31class FingerprintApi: 

32 """NOTE: This class is auto generated by the swagger code generator program. 

33 

34 Do not edit the class manually. 

35 Ref: https://github.com/swagger-api/swagger-codegen 

36 """ 

37 

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) 

42 

43 def delete_visitor_data(self, visitor_id: str, **kwargs) -> Union[None, AsyncResult[None]]: # noqa: E501 

44 """Delete data by visitor ID # noqa: E501 

45 

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() 

51 

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 

64 

65 def delete_visitor_data_with_http_info(self, visitor_id: str, **kwargs): # noqa: E501 

66 """Delete data by visitor ID # noqa: E501 

67 

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() 

73 

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 """ 

80 

81 all_params = [ 

82 'visitor_id', 

83 'async_req', 

84 '_return_http_data_only', 

85 '_preload_content', 

86 '_request_timeout'] 

87 

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 

100 

101 collection_formats = {} 

102 

103 path_params = {} 

104 if 'visitor_id' in params: 

105 path_params['visitor_id'] = params['visitor_id'] # noqa: E501 

106 

107 query_params = [('ii', 'fingerprint-pro-server-python-sdk/8.3.0-rc.0')] 

108 

109 header_params = {} 

110 

111 form_params = [] 

112 local_var_files = {} 

113 

114 body_params = None 

115 # HTTP header `Accept` 

116 header_params['Accept'] = self.api_client.select_header_accept( 

117 ['application/json']) # noqa: E501 

118 

119 # Authentication setting 

120 auth_settings = ['ApiKeyHeader', 'ApiKeyQuery'] # noqa: E501 

121 

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 

152 

153 def get_event(self, request_id: str, **kwargs) -> Union[EventsGetResponse, AsyncResult[EventsGetResponse]]: # noqa: E501 

154 """Get event by request ID # noqa: E501 

155 

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() 

161 

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 

174 

175 def get_event_with_http_info(self, request_id: str, **kwargs): # noqa: E501 

176 """Get event by request ID # noqa: E501 

177 

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() 

183 

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 """ 

190 

191 all_params = [ 

192 'request_id', 

193 'async_req', 

194 '_return_http_data_only', 

195 '_preload_content', 

196 '_request_timeout'] 

197 

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 

210 

211 collection_formats = {} 

212 

213 path_params = {} 

214 if 'request_id' in params: 

215 path_params['request_id'] = params['request_id'] # noqa: E501 

216 

217 query_params = [('ii', 'fingerprint-pro-server-python-sdk/8.3.0-rc.0')] 

218 

219 header_params = {} 

220 

221 form_params = [] 

222 local_var_files = {} 

223 

224 body_params = None 

225 # HTTP header `Accept` 

226 header_params['Accept'] = self.api_client.select_header_accept( 

227 ['application/json']) # noqa: E501 

228 

229 # Authentication setting 

230 auth_settings = ['ApiKeyHeader', 'ApiKeyQuery'] # noqa: E501 

231 

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 

256 

257 def get_related_visitors(self, visitor_id: str, **kwargs) -> Union[RelatedVisitorsResponse, AsyncResult[RelatedVisitorsResponse]]: # noqa: E501 

258 """Get Related Visitors # noqa: E501 

259 

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() 

265 

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 

278 

279 def get_related_visitors_with_http_info(self, visitor_id: str, **kwargs): # noqa: E501 

280 """Get Related Visitors # noqa: E501 

281 

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() 

287 

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 """ 

294 

295 all_params = [ 

296 'visitor_id', 

297 'async_req', 

298 '_return_http_data_only', 

299 '_preload_content', 

300 '_request_timeout'] 

301 

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 

314 

315 collection_formats = {} 

316 

317 path_params = {} 

318 

319 query_params = [('ii', 'fingerprint-pro-server-python-sdk/8.3.0-rc.0')] 

320 if 'visitor_id' in params: 

321 query_params.append(('visitor_id', params['visitor_id'])) # noqa: E501 

322 

323 header_params = {} 

324 

325 form_params = [] 

326 local_var_files = {} 

327 

328 body_params = None 

329 # HTTP header `Accept` 

330 header_params['Accept'] = self.api_client.select_header_accept( 

331 ['application/json']) # noqa: E501 

332 

333 # Authentication setting 

334 auth_settings = ['ApiKeyHeader', 'ApiKeyQuery'] # noqa: E501 

335 

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 

366 

367 def get_visits(self, visitor_id: str, **kwargs) -> Union[VisitorsGetResponse, AsyncResult[VisitorsGetResponse]]: # noqa: E501 

368 """Get visits by visitor ID # noqa: E501 

369 

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() 

375 

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 

393 

394 def get_visits_with_http_info(self, visitor_id: str, **kwargs): # noqa: E501 

395 """Get visits by visitor ID # noqa: E501 

396 

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() 

402 

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 """ 

414 

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'] 

426 

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 

439 

440 collection_formats = {} 

441 

442 path_params = {} 

443 if 'visitor_id' in params: 

444 path_params['visitor_id'] = params['visitor_id'] # noqa: E501 

445 

446 query_params = [('ii', 'fingerprint-pro-server-python-sdk/8.3.0-rc.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 

457 

458 header_params = {} 

459 

460 form_params = [] 

461 local_var_files = {} 

462 

463 body_params = None 

464 # HTTP header `Accept` 

465 header_params['Accept'] = self.api_client.select_header_accept( 

466 ['application/json']) # noqa: E501 

467 

468 # Authentication setting 

469 auth_settings = ['ApiKeyHeader', 'ApiKeyQuery'] # noqa: E501 

470 

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 

498 

499 def search_events(self, limit: int, **kwargs) -> Union[SearchEventsResponse, AsyncResult[SearchEventsResponse]]: # noqa: E501 

500 """Get events via search # noqa: E501 

501 

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() 

507 

508 :param async_req bool 

509 :param limit: Limit the number of events returned. (required) 

510 :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`.  

511 :param bot: Filter events by the bot detection result, specifically: - events where any kind of bot was detected. - events where a good bot was detected. - events where a bad bot was detected. - events where no bot was detected.  

512 :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  

513 :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.  

514 :param start: Filter events with a timestamp greater than the start time, in Unix time (milliseconds).  

515 :param end: Filter events with a timestamp smaller than the end time, in Unix time (milliseconds).  

516 :param reverse: Sort events in reverse timestamp order.  

517 :param suspect: Filter events previously tagged as suspicious via the [Update API](https://dev.fingerprint.com/reference/updateevent).  

518 :return: SearchEventsResponse 

519 If the method is called asynchronously, 

520 returns the request thread. 

521 """ 

522 kwargs['_return_http_data_only'] = True 

523 if kwargs.get('async_req'): 

524 return self.search_events_with_http_info(limit, **kwargs) # noqa: E501 

525 else: 

526 (data) = self.search_events_with_http_info(limit, **kwargs) # noqa: E501 

527 return data 

528 

529 def search_events_with_http_info(self, limit: int, **kwargs): # noqa: E501 

530 """Get events via search # noqa: E501 

531 

532 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 

533 This method makes a synchronous HTTP request by default. To make an 

534 asynchronous HTTP request, please pass async_req=True 

535 >>> thread = api.search_events_with_http_info(limit, async_req=True) 

536 >>> result = thread.get() 

537 

538 :param async_req bool 

539 :param int limit: Limit the number of events returned. (required) 

540 :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`.  

541 :param str bot: Filter events by the bot detection result, specifically: - events where any kind of bot was detected. - events where a good bot was detected. - events where a bad bot was detected. - events where no bot was detected.  

542 :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  

543 :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.  

544 :param int start: Filter events with a timestamp greater than the start time, in Unix time (milliseconds).  

545 :param int end: Filter events with a timestamp smaller than the end time, in Unix time (milliseconds).  

546 :param bool reverse: Sort events in reverse timestamp order.  

547 :param bool suspect: Filter events previously tagged as suspicious via the [Update API](https://dev.fingerprint.com/reference/updateevent).  

548 :return: SearchEventsResponse 

549 If the method is called asynchronously, 

550 returns the request thread. 

551 """ 

552 

553 all_params = [ 

554 'limit', 

555 'visitor_id', 

556 'bot', 

557 'ip_address', 

558 'linked_id', 

559 'start', 

560 'end', 

561 'reverse', 

562 'suspect', 

563 'async_req', 

564 '_return_http_data_only', 

565 '_preload_content', 

566 '_request_timeout'] 

567 

568 params = locals() 

569 for key, val in params['kwargs'].items(): 

570 if key not in all_params: 

571 raise TypeError( 

572 "Got an unexpected keyword argument '%s'" 

573 " to method search_events" % key 

574 ) 

575 params[key] = val 

576 del params['kwargs'] 

577 # verify the required parameter 'limit' is set 

578 if 'limit' not in params or params['limit'] is None: 

579 raise ValueError("Missing the required parameter `limit` when calling `search_events`") # noqa: E501 

580 

581 collection_formats = {} 

582 

583 path_params = {} 

584 

585 query_params = [('ii', 'fingerprint-pro-server-python-sdk/8.3.0-rc.0')] 

586 if 'limit' in params: 

587 query_params.append(('limit', params['limit'])) # noqa: E501 

588 if 'visitor_id' in params: 

589 query_params.append(('visitor_id', params['visitor_id'])) # noqa: E501 

590 if 'bot' in params: 

591 query_params.append(('bot', params['bot'])) # noqa: E501 

592 if 'ip_address' in params: 

593 query_params.append(('ip_address', params['ip_address'])) # noqa: E501 

594 if 'linked_id' in params: 

595 query_params.append(('linked_id', params['linked_id'])) # noqa: E501 

596 if 'start' in params: 

597 query_params.append(('start', params['start'])) # noqa: E501 

598 if 'end' in params: 

599 query_params.append(('end', params['end'])) # noqa: E501 

600 if 'reverse' in params: 

601 query_params.append(('reverse', params['reverse'])) # noqa: E501 

602 if 'suspect' in params: 

603 query_params.append(('suspect', params['suspect'])) # noqa: E501 

604 

605 header_params = {} 

606 

607 form_params = [] 

608 local_var_files = {} 

609 

610 body_params = None 

611 # HTTP header `Accept` 

612 header_params['Accept'] = self.api_client.select_header_accept( 

613 ['application/json']) # noqa: E501 

614 

615 # Authentication setting 

616 auth_settings = ['ApiKeyHeader', 'ApiKeyQuery'] # noqa: E501 

617 

618 try: 

619 return self.api_client.call_api( 

620 '/events/search', 'GET', 

621 path_params, 

622 query_params, 

623 header_params, 

624 body=body_params, 

625 post_params=form_params, 

626 files=local_var_files, 

627 response_type='SearchEventsResponse', # noqa: E501 

628 auth_settings=auth_settings, 

629 async_req=params.get('async_req'), 

630 _return_http_data_only=params.get('_return_http_data_only'), 

631 _preload_content=params.get('_preload_content', True), 

632 _request_timeout=params.get('_request_timeout'), 

633 collection_formats=collection_formats) 

634 except ApiException as e: 

635 if e.status == 400: 

636 error = self.api_client.deserialize(e, 'ErrorResponse', True) 

637 raise extend_exception(e, error) 

638 if e.status == 403: 

639 error = self.api_client.deserialize(e, 'ErrorResponse', True) 

640 raise extend_exception(e, error) 

641 raise e 

642 

643 def update_event(self, body: EventsUpdateRequest, request_id: str, **kwargs) -> Union[None, AsyncResult[None]]: # noqa: E501 

644 """Update an event with a given request ID # noqa: E501 

645 

646 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 

647 This method makes a synchronous HTTP request by default. To make an 

648 asynchronous HTTP request, please pass async_req=True 

649 >>> thread = api.update_event(body, request_id, async_req=True) 

650 >>> result = thread.get() 

651 

652 :param async_req bool 

653 :param body: (required) 

654 :param request_id: The unique event [identifier](https://dev.fingerprint.com/reference/get-function#requestid). (required) 

655 :return: None 

656 If the method is called asynchronously, 

657 returns the request thread. 

658 """ 

659 kwargs['_return_http_data_only'] = True 

660 if kwargs.get('async_req'): 

661 return self.update_event_with_http_info(body, request_id, **kwargs) # noqa: E501 

662 else: 

663 (data) = self.update_event_with_http_info(body, request_id, **kwargs) # noqa: E501 

664 return data 

665 

666 def update_event_with_http_info(self, body: EventsUpdateRequest, request_id: str, **kwargs): # noqa: E501 

667 """Update an event with a given request ID # noqa: E501 

668 

669 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 

670 This method makes a synchronous HTTP request by default. To make an 

671 asynchronous HTTP request, please pass async_req=True 

672 >>> thread = api.update_event_with_http_info(body, request_id, async_req=True) 

673 >>> result = thread.get() 

674 

675 :param async_req bool 

676 :param EventsUpdateRequest body: (required) 

677 :param str request_id: The unique event [identifier](https://dev.fingerprint.com/reference/get-function#requestid). (required) 

678 :return: None 

679 If the method is called asynchronously, 

680 returns the request thread. 

681 """ 

682 

683 all_params = [ 

684 'body', 

685 'request_id', 

686 'async_req', 

687 '_return_http_data_only', 

688 '_preload_content', 

689 '_request_timeout'] 

690 

691 params = locals() 

692 for key, val in params['kwargs'].items(): 

693 if key not in all_params: 

694 raise TypeError( 

695 "Got an unexpected keyword argument '%s'" 

696 " to method update_event" % key 

697 ) 

698 params[key] = val 

699 del params['kwargs'] 

700 # verify the required parameter 'body' is set 

701 if 'body' not in params or params['body'] is None: 

702 raise ValueError("Missing the required parameter `body` when calling `update_event`") # noqa: E501 

703 # verify the required parameter 'request_id' is set 

704 if 'request_id' not in params or params['request_id'] is None: 

705 raise ValueError("Missing the required parameter `request_id` when calling `update_event`") # noqa: E501 

706 

707 collection_formats = {} 

708 

709 path_params = {} 

710 if 'request_id' in params: 

711 path_params['request_id'] = params['request_id'] # noqa: E501 

712 

713 query_params = [('ii', 'fingerprint-pro-server-python-sdk/8.3.0-rc.0')] 

714 

715 header_params = {} 

716 

717 form_params = [] 

718 local_var_files = {} 

719 

720 body_params = None 

721 if 'body' in params: 

722 body_params = params['body'] 

723 # HTTP header `Accept` 

724 header_params['Accept'] = self.api_client.select_header_accept( 

725 ['application/json']) # noqa: E501 

726 

727 # HTTP header `Content-Type` 

728 header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 

729 ['application/json']) # noqa: E501 

730 

731 # Authentication setting 

732 auth_settings = ['ApiKeyHeader', 'ApiKeyQuery'] # noqa: E501 

733 

734 try: 

735 return self.api_client.call_api( 

736 '/events/{request_id}', 'PUT', 

737 path_params, 

738 query_params, 

739 header_params, 

740 body=body_params, 

741 post_params=form_params, 

742 files=local_var_files, 

743 response_type=None, # noqa: E501 

744 auth_settings=auth_settings, 

745 async_req=params.get('async_req'), 

746 _return_http_data_only=params.get('_return_http_data_only'), 

747 _preload_content=params.get('_preload_content', True), 

748 _request_timeout=params.get('_request_timeout'), 

749 collection_formats=collection_formats) 

750 except ApiException as e: 

751 if e.status == 400: 

752 error = self.api_client.deserialize(e, 'ErrorResponse', True) 

753 raise extend_exception(e, error) 

754 if e.status == 403: 

755 error = self.api_client.deserialize(e, 'ErrorResponse', True) 

756 raise extend_exception(e, error) 

757 if e.status == 404: 

758 error = self.api_client.deserialize(e, 'ErrorResponse', True) 

759 raise extend_exception(e, error) 

760 if e.status == 409: 

761 error = self.api_client.deserialize(e, 'ErrorResponse', True) 

762 raise extend_exception(e, error) 

763 raise e