|
12 | 12 |
|
13 | 13 | # create an instance of the API class
|
14 | 14 | api_instance = fingerprint_pro_server_api_sdk.FingerprintApi(configuration)
|
15 |
| -visitor_id = os.environ["VISITOR_ID"] |
16 |
| -request_id = os.environ["REQUEST_ID"] |
17 | 15 |
|
| 16 | +# FingerprintApi->search_events usage example |
18 | 17 | try:
|
19 |
| - visits_response = api_instance.get_visits(visitor_id, limit=2) |
20 |
| - pagination_key = visits_response.pagination_key |
21 |
| - print("\n\n\nVisits response: \n", visits_response) |
| 18 | + search_events_response = api_instance.search_events(2) |
| 19 | + first_event = search_events_response.events[0] |
| 20 | + first_event_identification_data = first_event.products.identification.data |
| 21 | + visitor_id = first_event_identification_data.visitor_id |
| 22 | + request_id = first_event_identification_data.request_id |
| 23 | + print("\n\n\nSearch events response: \n", search_events_response) |
| 24 | + search_events_response_second_page = api_instance.search_events(2, pagination_key=search_events_response.pagination_key) |
22 | 25 |
|
23 |
| - visits_response = api_instance.get_visits( |
24 |
| - visitor_id, limit=2, pagination_key=pagination_key) |
| 26 | + if len(search_events_response_second_page.events) == 0: |
| 27 | + print("Second page of FingerprintApi->search_events: is empty") |
| 28 | + exit(1) |
25 | 29 |
|
26 | 30 | except ApiException as e:
|
27 |
| - print("Exception when calling DefaultApi->visitors_visitor_id_get: %s\n" % e) |
| 31 | + print("Exception when calling FingerprintApi->search_events: %s\n" % e) |
28 | 32 | exit(1)
|
29 | 33 |
|
| 34 | +# Use existing visitor_id from FingerprintApi->search_events response to check FingerprintApi->get_visits method |
30 | 35 | try:
|
31 |
| - events_response = api_instance.get_event(request_id) |
32 |
| - print("\n\n\nEvent response: \n", events_response.products) |
| 36 | + visits_response = api_instance.get_visits(visitor_id, limit=2) |
| 37 | + print("\n\n\nVisits response: \n", visits_response) |
33 | 38 |
|
34 | 39 | except ApiException as e:
|
35 |
| - print("Exception when calling DefaultApi->get_event: %s\n" % e) |
| 40 | + print("Exception when calling FingerprintApi->get_visits: %s\n" % e) |
36 | 41 | exit(1)
|
37 | 42 |
|
| 43 | +# Use existing request_id from FingerprintApi->search_events response to check FingerprintApi->get_event method |
38 | 44 | try:
|
39 |
| - search_events_response = api_instance.search_events(2, bot="bad") |
40 |
| - print("\n\n\nSearch events response: \n", search_events_response) |
| 45 | + events_response = api_instance.get_event(request_id) |
| 46 | + print("\n\n\nEvent response: \n", events_response.products) |
41 | 47 |
|
42 | 48 | except ApiException as e:
|
43 |
| - print("Exception when calling DefaultApi->search_events: %s\n" % e) |
| 49 | + print("Exception when calling FingerprintApi->get_event: %s\n" % e) |
44 | 50 | exit(1)
|
45 | 51 |
|
46 | 52 | # Async methods examples
|
|
0 commit comments