|
21 | 21 | # FingerprintApi->search_events usage example
|
22 | 22 | try:
|
23 | 23 | search_events_response = api_instance.search_events(2, start=start, end=end)
|
| 24 | + if len(search_events_response.events) == 0: |
| 25 | + print("FingerprintApi.search_events: is empty") |
| 26 | + exit(1) |
24 | 27 | first_event = search_events_response.events[0]
|
25 | 28 | first_event_identification_data = first_event.products.identification.data
|
26 | 29 | visitor_id = first_event_identification_data.visitor_id
|
|
29 | 32 | search_events_response_second_page = api_instance.search_events(2, start=start, end=end, pagination_key=search_events_response.pagination_key)
|
30 | 33 |
|
31 | 34 | if len(search_events_response_second_page.events) == 0:
|
32 |
| - print("Second page of FingerprintApi->search_events: is empty") |
| 35 | + print("Second page of FingerprintApi.search_events: is empty") |
33 | 36 | exit(1)
|
34 | 37 |
|
35 | 38 | except ApiException as e:
|
36 |
| - print("Exception when calling FingerprintApi->search_events: %s\n" % e) |
| 39 | + print("Exception when calling FingerprintApi.search_events: %s\n" % e) |
37 | 40 | exit(1)
|
38 | 41 |
|
39 | 42 | # Use existing visitor_id from FingerprintApi->search_events response to check FingerprintApi->get_visits method
|
|
42 | 45 | print("\n\n\nVisits response: \n", visits_response)
|
43 | 46 |
|
44 | 47 | except ApiException as e:
|
45 |
| - print("Exception when calling FingerprintApi->get_visits: %s\n" % e) |
| 48 | + print("Exception when calling FingerprintApi.get_visits: %s\n" % e) |
46 | 49 | exit(1)
|
47 | 50 |
|
48 | 51 | # Use existing request_id from FingerprintApi->search_events response to check FingerprintApi->get_event method
|
|
51 | 54 | print("\n\n\nEvent response: \n", events_response.products)
|
52 | 55 |
|
53 | 56 | except ApiException as e:
|
54 |
| - print("Exception when calling FingerprintApi->get_event: %s\n" % e) |
| 57 | + print("Exception when calling FingerprintApi.get_event: %s\n" % e) |
55 | 58 | exit(1)
|
56 | 59 |
|
57 | 60 | # Async methods examples
|
|
69 | 72 | # Check that old events are still match expected format
|
70 | 73 | try:
|
71 | 74 | search_events_response_old = api_instance.search_events(1, start=start, end=end, reverse=True)
|
| 75 | + if len(search_events_response_old.events) == 0: |
| 76 | + print("FingerprintApi.search_events: is empty for old events\n") |
| 77 | + exit(1) |
72 | 78 | old_event_identification_data = search_events_response_old.events[0].products.identification.data
|
73 | 79 | visitor_id_old = old_event_identification_data.visitor_id
|
74 | 80 | request_id_old = old_event_identification_data.request_id
|
75 | 81 |
|
| 82 | + if visitor_id_old == visitor_id or request_id_old == request_id: |
| 83 | + print("Old events are identical to new\n") |
| 84 | + exit(1) |
| 85 | + |
76 | 86 | api_instance.get_visits(visitor_id_old, limit=2)
|
77 | 87 | api_instance.get_event(request_id_old)
|
78 | 88 | print("\n\n\nOld events are good\n")
|
|
0 commit comments