-
Notifications
You must be signed in to change notification settings - Fork 1
/
run_checks.py
53 lines (40 loc) · 1.68 KB
/
run_checks.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import os
import fingerprint_pro_server_api_sdk
from fingerprint_pro_server_api_sdk.rest import ApiException
from dotenv import load_dotenv
load_dotenv()
# configure
configuration = fingerprint_pro_server_api_sdk.Configuration(
api_key=os.environ["PRIVATE_KEY"], region=os.environ.get("REGION", "us"))
# create an instance of the API class
api_instance = fingerprint_pro_server_api_sdk.FingerprintApi(configuration)
visitor_id = os.environ["VISITOR_ID"]
request_id = os.environ["REQUEST_ID"]
try:
visits_response = api_instance.get_visits(visitor_id, limit=2)
pagination_key = visits_response.pagination_key
print("\n\n\nVisits response: \n", visits_response)
visits_response = api_instance.get_visits(
visitor_id, limit=2, pagination_key=pagination_key)
except ApiException as e:
print("Exception when calling DefaultApi->visitors_visitor_id_get: %s\n" % e)
exit(1)
try:
events_response = api_instance.get_event(request_id)
print("\n\n\nEvent response: \n", events_response.products)
except ApiException as e:
print("Exception when calling DefaultApi->get_event: %s\n" % e)
exit(1)
# Async methods examples
try:
visits_response_request = api_instance.get_visits(visitor_id, limit=2, async_req=True)
events_response_request = api_instance.get_event(request_id, async_req=True)
visits_response = visits_response_request.get()
print("\n\n\nVisits async response: \n", visits_response)
events_response = events_response_request.get()
print("\n\n\nEvent async response: \n", events_response.products)
except ApiException as e:
print("Exception when calling Async example: %s\n" % e)
exit(1)
print("Checks passed!")
exit(0)