|
1 | 1 | import os
|
| 2 | +from datetime import datetime, timedelta |
2 | 3 |
|
3 | 4 | import fingerprint_pro_server_api_sdk
|
4 | 5 | from fingerprint_pro_server_api_sdk.rest import ApiException
|
|
13 | 14 | # create an instance of the API class
|
14 | 15 | api_instance = fingerprint_pro_server_api_sdk.FingerprintApi(configuration)
|
15 | 16 |
|
| 17 | +end = int(datetime.now().timestamp() * 1000) |
| 18 | +start = int((datetime.now() - timedelta(days=90)).timestamp() * 1000) |
| 19 | + |
| 20 | + |
16 | 21 | # FingerprintApi->search_events usage example
|
17 | 22 | try:
|
18 |
| - search_events_response = api_instance.search_events(2) |
| 23 | + search_events_response = api_instance.search_events(2, start=start, end=end) |
19 | 24 | first_event = search_events_response.events[0]
|
20 | 25 | first_event_identification_data = first_event.products.identification.data
|
21 | 26 | visitor_id = first_event_identification_data.visitor_id
|
22 | 27 | request_id = first_event_identification_data.request_id
|
23 | 28 | 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) |
| 29 | + search_events_response_second_page = api_instance.search_events(2, start=start, end=end, pagination_key=search_events_response.pagination_key) |
25 | 30 |
|
26 | 31 | if len(search_events_response_second_page.events) == 0:
|
27 | 32 | print("Second page of FingerprintApi->search_events: is empty")
|
|
61 | 66 | print("Exception when calling Async example: %s\n" % e)
|
62 | 67 | exit(1)
|
63 | 68 |
|
| 69 | +try: |
| 70 | + search_events_response_old = api_instance.search_events(1, start=start, end=end, reverse=True) |
| 71 | + old_event_identification_data = search_events_response_old.events[0].products.identification.data |
| 72 | + visitor_id_old = old_event_identification_data.visitor_id |
| 73 | + request_id_old = old_event_identification_data.request_id |
| 74 | + |
| 75 | + api_instance.get_visits(visitor_id_old, limit=2) |
| 76 | + api_instance.get_event(request_id_old) |
| 77 | + print("\n\n\nOld events are good\n") |
| 78 | +except ApiException as e: |
| 79 | + print("Exception when trying to read old data: %s\n" % e) |
| 80 | + |
64 | 81 | print("Checks passed!")
|
65 | 82 |
|
66 | 83 | exit(0)
|
0 commit comments