diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES index fe9e7dbb..dadb859f 100644 --- a/.openapi-generator/FILES +++ b/.openapi-generator/FILES @@ -8,11 +8,14 @@ docs/BotResult.md docs/BrowserDetails.md docs/Canvas.md docs/DecryptionKey.md +docs/EdgeRequest.md +docs/EdgeRequestHeadersInner.md docs/Emoji.md docs/Error.md docs/ErrorCode.md docs/ErrorResponse.md docs/Event.md +docs/EventEdge.md docs/EventRuleAction.md docs/EventRuleActionAllow.md docs/EventRuleActionBlock.md @@ -79,11 +82,14 @@ fingerprint_server_sdk/models/bot_info_identity.py fingerprint_server_sdk/models/bot_result.py fingerprint_server_sdk/models/browser_details.py fingerprint_server_sdk/models/canvas.py +fingerprint_server_sdk/models/edge_request.py +fingerprint_server_sdk/models/edge_request_headers_inner.py fingerprint_server_sdk/models/emoji.py fingerprint_server_sdk/models/error.py fingerprint_server_sdk/models/error_code.py fingerprint_server_sdk/models/error_response.py fingerprint_server_sdk/models/event.py +fingerprint_server_sdk/models/event_edge.py fingerprint_server_sdk/models/event_rule_action.py fingerprint_server_sdk/models/event_rule_action_allow.py fingerprint_server_sdk/models/event_rule_action_block.py diff --git a/README.md b/README.md index 3b60ff26..5a6f7871 100644 --- a/README.md +++ b/README.md @@ -303,6 +303,7 @@ All URIs are relative to *https://api.fpjs.io/v4* Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- +*FingerprintApi* | [**analyze_request_for_automation_intelligence**](docs/FingerprintApi.md#analyze_request_for_automation_intelligence) | **POST** /edge | Collect Automation Intelligence. *FingerprintApi* | [**delete_visitor_data**](docs/FingerprintApi.md#delete_visitor_data) | **DELETE** /visitors/{visitor_id} | Delete a visitor ID *FingerprintApi* | [**get_event**](docs/FingerprintApi.md#get_event) | **GET** /events/{event_id} | Get an event by event ID *FingerprintApi* | [**search_events**](docs/FingerprintApi.md#search_events) | **GET** /events | Search events @@ -318,11 +319,14 @@ Class | Method | HTTP request | Description - [BotResult](docs/BotResult.md) - [BrowserDetails](docs/BrowserDetails.md) - [Canvas](docs/Canvas.md) + - [EdgeRequest](docs/EdgeRequest.md) + - [EdgeRequestHeadersInner](docs/EdgeRequestHeadersInner.md) - [Emoji](docs/Emoji.md) - [Error](docs/Error.md) - [ErrorCode](docs/ErrorCode.md) - [ErrorResponse](docs/ErrorResponse.md) - [Event](docs/Event.md) + - [EventEdge](docs/EventEdge.md) - [EventRuleAction](docs/EventRuleAction.md) - [EventRuleActionAllow](docs/EventRuleActionAllow.md) - [EventRuleActionBlock](docs/EventRuleActionBlock.md) diff --git a/README.pypi.md b/README.pypi.md index ea4c29f9..d242ece4 100644 --- a/README.pypi.md +++ b/README.pypi.md @@ -299,6 +299,7 @@ All URIs are relative to *https://api.fpjs.io/v4* Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- +*FingerprintApi* | [**analyze_request_for_automation_intelligence**](https://github.com/fingerprintjs/python-sdk/blob/main/docs/FingerprintApi.md#analyze_request_for_automation_intelligence) | **POST** /edge | Collect Automation Intelligence. *FingerprintApi* | [**delete_visitor_data**](https://github.com/fingerprintjs/python-sdk/blob/main/docs/FingerprintApi.md#delete_visitor_data) | **DELETE** /visitors/{visitor_id} | Delete a visitor ID *FingerprintApi* | [**get_event**](https://github.com/fingerprintjs/python-sdk/blob/main/docs/FingerprintApi.md#get_event) | **GET** /events/{event_id} | Get an event by event ID *FingerprintApi* | [**search_events**](https://github.com/fingerprintjs/python-sdk/blob/main/docs/FingerprintApi.md#search_events) | **GET** /events | Search events @@ -314,11 +315,14 @@ Class | Method | HTTP request | Description - [BotResult](https://github.com/fingerprintjs/python-sdk/blob/main/docs/BotResult.md) - [BrowserDetails](https://github.com/fingerprintjs/python-sdk/blob/main/docs/BrowserDetails.md) - [Canvas](https://github.com/fingerprintjs/python-sdk/blob/main/docs/Canvas.md) + - [EdgeRequest](https://github.com/fingerprintjs/python-sdk/blob/main/docs/EdgeRequest.md) + - [EdgeRequestHeadersInner](https://github.com/fingerprintjs/python-sdk/blob/main/docs/EdgeRequestHeadersInner.md) - [Emoji](https://github.com/fingerprintjs/python-sdk/blob/main/docs/Emoji.md) - [Error](https://github.com/fingerprintjs/python-sdk/blob/main/docs/Error.md) - [ErrorCode](https://github.com/fingerprintjs/python-sdk/blob/main/docs/ErrorCode.md) - [ErrorResponse](https://github.com/fingerprintjs/python-sdk/blob/main/docs/ErrorResponse.md) - [Event](https://github.com/fingerprintjs/python-sdk/blob/main/docs/Event.md) + - [EventEdge](https://github.com/fingerprintjs/python-sdk/blob/main/docs/EventEdge.md) - [EventRuleAction](https://github.com/fingerprintjs/python-sdk/blob/main/docs/EventRuleAction.md) - [EventRuleActionAllow](https://github.com/fingerprintjs/python-sdk/blob/main/docs/EventRuleActionAllow.md) - [EventRuleActionBlock](https://github.com/fingerprintjs/python-sdk/blob/main/docs/EventRuleActionBlock.md) diff --git a/docs/EdgeRequest.md b/docs/EdgeRequest.md new file mode 100644 index 00000000..3d7e0740 --- /dev/null +++ b/docs/EdgeRequest.md @@ -0,0 +1,17 @@ +# EdgeRequest +HTTP request metadata (including the HTTP method, headers and IP address) sent by you (your server) to the Fingerprint API for IP and bot analysis. To improve accuracy, retain as much of the original semantics of the HTTP request as possible. For example, preserve the order of the request headers and their capitalization. +At least one of `ipv4_address` or `ipv6_address` must be provided; a request with neither is rejected with a `400` error. If both IPv4 and IPv6 are provided, IP intelligence will be provided for each address. If an IPv4-mapped IPv6 address is provided in the `ipv6_address` request property, the IP intelligence will be provided in the `ipv4_address` property of the response. + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**headers** | [**List[EdgeRequestHeadersInner]**](EdgeRequestHeadersInner.md) | Ordered header entries from the request made to your server. Each entry represents one header line. If one header name appears as multiple lines, send each as a separate item in the array. Headers that contain authentication or session data must still be included, but with their value set to an empty string. This includes headers like `Authorization` and `Cookie`, but may contain more depending on your specific project, for instance `Proxy-Authenticate` or `X-Api-Key`. Omitting the headers entirely changes the shape of the request and can affect detection. Never forward the real secret values. Whenever possible, we recommend preserving header order and capitalization to provide the best accuracy, however it’s not a strict requirement if your runtime does not maintain http header order or canonicalizes header names. | +**method** | **str** | The original HTTP method of the request. If supported in your runtime, preserve the original casing. | +**url** | **str** | Absolute URL of the request, without a \\#fragment suffix. Only HTTP and HTTPS schemes are supported. | +**ipv4_address** | **str** | Client IPv4 address observed by your server. | [optional] +**ipv6_address** | **str** | Client IPv6 address observed by your server. | [optional] +**linked_id** | **str** | A customer-provided id that was sent with the request. | [optional] +**tags** | **Dict[str, object]** | A customer-provided value or an object that was sent with the identification request or updated later. | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/docs/EdgeRequestHeadersInner.md b/docs/EdgeRequestHeadersInner.md new file mode 100644 index 00000000..0fc3f1f8 --- /dev/null +++ b/docs/EdgeRequestHeadersInner.md @@ -0,0 +1,9 @@ +# EdgeRequestHeadersInner +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **str** | Header name as forwarded by your server. Headers must be valid according to RFC 7230 and will be canonicalized according to RFC 9112. | +**value** | **str** | Value of a single forwarded header entry. Be careful to preserve the original encoding and escaping. For example, do not double escape quotes. | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/docs/Event.md b/docs/Event.md index 93434207..cdd12c7e 100644 --- a/docs/Event.md +++ b/docs/Event.md @@ -1,22 +1,35 @@ # Event -Contains results from Fingerprint Identification and all active Smart Signals. Some Smart Signals are only supported for certain device types, these fields will be omitted for events not generated from the supported devices. Consult the [Smart Signals reference](https://docs.fingerprint.com/docs/smart-signals-reference) for more details. +An identification event (`source: device`) or an Automation Intelligence event (`source: edge`). + +Use `source` to tell them apart. Device events include Identification and device-derived Smart Signals. Edge events do not. + +Consult the [Smart Signals reference](https://docs.fingerprint.com/docs/smart-signals-reference) for more details. + ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **event_id** | **str** | Unique identifier of the user's request. The first portion of the event_id is a unix epoch milliseconds timestamp. | **timestamp** | **int** | Timestamp of the event with millisecond precision in Unix time. | +**linked_id** | **str** | A customer-provided id that was sent with the request. | [optional] +**tags** | **Dict[str, object]** | A customer-provided value or an object that was sent with the identification request or updated later. | [optional] +**url** | **str** | Page URL from which the request was sent. | [optional] +**bot_info** | [**BotInfo**](BotInfo.md) | | [optional] +**ip_info** | [**IPInfo**](IPInfo.md) | | [optional] +**proxy** | **bool** | IP address was used by a public proxy provider or belonged to a known recent residential proxy | [optional] +**proxy_confidence** | [**ProxyConfidence**](ProxyConfidence.md) | | [optional] +**proxy_details** | [**ProxyDetails**](ProxyDetails.md) | | [optional] +**vpn** | **bool** | VPN or other anonymizing service has been used when sending the request. | [optional] +**vpn_confidence** | [**VpnConfidence**](VpnConfidence.md) | | [optional] +**vpn_methods** | [**VpnMethods**](VpnMethods.md) | | [optional] **source** | [**EventSource**](EventSource.md) | | [optional] **incremental_identification_status** | [**IncrementalIdentificationStatus**](IncrementalIdentificationStatus.md) | | [optional] -**linked_id** | **str** | A customer-provided id that was sent with the request. | [optional] **environment_id** | **str** | Environment Id of the event. | [optional] -**suspect** | **bool** | Field is `true` if you have previously set the `suspect` flag for this event using the [Server API Update event endpoint](https://docs.fingerprint.com/reference/server-api-v4-update-event). | [optional] +**suspect** | **bool** | Field is `true` if you have previously set the `suspect` flag for this event using the [Server API Update event endpoint](https://docs.fingerprint.com/reference/server-api-update-event). | [optional] **sdk** | [**SDK**](SDK.md) | | [optional] **replayed** | **bool** | `true` if we determined that this payload was replayed, `false` otherwise. | [optional] **identification** | [**Identification**](Identification.md) | | [optional] **supplementary_id_high_recall** | [**SupplementaryIDHighRecall**](SupplementaryIDHighRecall.md) | | [optional] -**tags** | **Dict[str, object]** | A customer-provided value or an object that was sent with the identification request or updated later. | [optional] -**url** | **str** | Page URL from which the request was sent. | [optional] **bundle_id** | **str** | Bundle Id of the iOS application integrated with the Fingerprint SDK for the event. | [optional] **package_name** | **str** | Package name of the Android application integrated with the Fingerprint SDK for the event. | [optional] **ip_address** | **str** | IP address of the requesting browser or bot. | [optional] @@ -30,17 +43,12 @@ Name | Type | Description | Notes **active_call** | **bool** | Indicates whether the mobile device had an active call (cellular or VoIP) at the time of the request. Available from SDK 2.16.0+ on iOS and Android. | [optional] **bot** | [**BotResult**](BotResult.md) | | [optional] **bot_type** | **str** | Additional classification of the bot type if detected. | [optional] -**bot_info** | [**BotInfo**](BotInfo.md) | | [optional] **cloned_app** | **bool** | Android specific cloned application detection. There are 2 values: * `true` - Presence of app cloners work detected (e.g. fully cloned application found or launch of it inside of a not main working profile detected). * `false` - No signs of cloned application detected or the client is not Android. | [optional] **developer_tools** | **bool** | `true` if the browser has DevTools open (Chrome, Firefox) or the Android/iOS device has Developer Tools enabled, `false` otherwise. | [optional] **emulator** | **bool** | Android specific emulator detection. There are 2 values: * `true` - Emulated environment detected (e.g. launch inside of AVD). * `false` - No signs of emulated environment detected or the client is not Android. | [optional] **factory_reset_timestamp** | **int** | The time of the most recent factory reset that happened on the **mobile device** is expressed as Unix epoch time. When a factory reset cannot be detected on the mobile device or when the request is initiated from a browser, this field will correspond to the *epoch* time (i.e 1 Jan 1970 UTC) as a value of 0. See [Factory Reset Detection](https://docs.fingerprint.com/docs/smart-signals-reference#factory-reset-detection) to learn more about this Smart Signal. | [optional] **frida** | **bool** | [Frida](https://frida.re/docs/) detection for Android and iOS devices. There are 2 values: * `true` - Frida detected * `false` - No signs of Frida or the client is not a mobile device. | [optional] **ip_blocklist** | [**IPBlockList**](IPBlockList.md) | | [optional] -**ip_info** | [**IPInfo**](IPInfo.md) | | [optional] -**proxy** | **bool** | IP address was used by a public proxy provider or belonged to a known recent residential proxy | [optional] -**proxy_confidence** | [**ProxyConfidence**](ProxyConfidence.md) | | [optional] -**proxy_details** | [**ProxyDetails**](ProxyDetails.md) | | [optional] **proxy_ml_score** | **float** | Machine learning–based proxy score, represented as a floating-point value between 0 and 1 (inclusive), with up to three decimal places of precision. A higher score means a higher confidence in the positive `proxy` detection result. This Smart Signal is currently in beta and only available to select customers. If you are interested, please [contact our support team](https://fingerprint.com/support/). | [optional] **incognito** | **bool** | `true` if we detected incognito mode used in the browser, `false` otherwise. | [optional] **jailbroken** | **bool** | iOS specific jailbreak detection. There are 2 values: * `true` - Jailbreak detected. * `false` - No signs of jailbreak or the client is not iOS. | [optional] @@ -58,12 +66,9 @@ Name | Type | Description | Notes **velocity** | [**Velocity**](Velocity.md) | | [optional] **virtual_machine** | **bool** | `true` if the request came from a browser running inside a virtual machine (e.g. VMWare), `false` otherwise. | [optional] **virtual_machine_ml_score** | **float** | Machine learning–based virtual machine score, represented as a floating-point value between 0 and 1 (inclusive), with up to three decimal places of precision. A higher score means a higher confidence in the positive `virtual_machine` detection result. This Smart Signal is currently in beta and only available to select customers. If you are interested, please [contact our support team](https://fingerprint.com/support/). | [optional] -**vpn** | **bool** | VPN or other anonymizing service has been used when sending the request. | [optional] -**vpn_confidence** | [**VpnConfidence**](VpnConfidence.md) | | [optional] **vpn_ml_score** | **float** | Machine learning–based VPN score, represented as a floating-point value between 0 and 1 (inclusive), with up to three decimal places of precision. A higher score means a higher confidence in the positive `vpn` detection result. This Smart Signal is currently in beta and only available to select customers. If you are interested, please [contact our support team](https://fingerprint.com/support/). | [optional] **vpn_origin_timezone** | **str** | Local timezone which is used in timezone_mismatch method. | [optional] **vpn_origin_country** | **str** | Country of the request (Android SDK version >= 2.4.0, iOS SDK version >= 2.9.0, JS agent >= 3.12.9 / 4.0.2), ISO 3166 format or unknown. | [optional] -**vpn_methods** | [**VpnMethods**](VpnMethods.md) | | [optional] **high_activity_device** | **bool** | Flag indicating if the request came from a high-activity visitor. | [optional] **rare_device** | **bool** | `true` if the device is considered rare based on its combination of hardware and software attributes. A device is classified as rare if it falls within the top 99.9 percentile (lowest-frequency segment) of observed traffic, or if its configuration has not been previously seen (`not_seen`). > This Smart Signal is currently in beta and only available to select customers. If you are interested, please [contact our support team](https://fingerprint.com/support/). | [optional] **rare_device_percentile_bucket** | [**RareDevicePercentileBucket**](RareDevicePercentileBucket.md) | | [optional] diff --git a/docs/EventEdge.md b/docs/EventEdge.md new file mode 100644 index 00000000..87e12dcd --- /dev/null +++ b/docs/EventEdge.md @@ -0,0 +1,24 @@ +# EventEdge +IP and bot analysis for an event generated by the Automation Intelligence API (`/edge` endpoint). No client-side collection agent is involved, so Identification (`visitor_id`) and device-telemetry-derived Smart Signals are not available. + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**event_id** | **str** | Unique identifier of the user's request. The first portion of the event_id is a unix epoch milliseconds timestamp. | +**timestamp** | **int** | Timestamp of the event with millisecond precision in Unix time. | +**linked_id** | **str** | A customer-provided id that was sent with the request. | [optional] +**tags** | **Dict[str, object]** | A customer-provided value or an object that was sent with the identification request or updated later. | [optional] +**url** | **str** | Page URL from which the request was sent. | [optional] +**bot_info** | [**BotInfo**](BotInfo.md) | | [optional] +**ip_info** | [**IPInfo**](IPInfo.md) | | +**proxy** | **bool** | IP address was used by a public proxy provider or belonged to a known recent residential proxy | [optional] +**proxy_confidence** | [**ProxyConfidence**](ProxyConfidence.md) | | [optional] +**proxy_details** | [**ProxyDetails**](ProxyDetails.md) | | [optional] +**vpn** | **bool** | VPN or other anonymizing service has been used when sending the request. | [optional] +**vpn_confidence** | [**VpnConfidence**](VpnConfidence.md) | | [optional] +**vpn_methods** | [**VpnMethods**](VpnMethods.md) | | [optional] +**source** | [**EventSource**](EventSource.md) | | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/docs/FingerprintApi.md b/docs/FingerprintApi.md index 785d4333..5438276e 100644 --- a/docs/FingerprintApi.md +++ b/docs/FingerprintApi.md @@ -4,12 +4,105 @@ All URIs are relative to *https://api.fpjs.io/v4* Method | HTTP request | Description ------------- | ------------- | ------------- +[**analyze_request_for_automation_intelligence**](FingerprintApi.md#analyze_request_for_automation_intelligence) | **POST** /edge | Collect Automation Intelligence. [**delete_visitor_data**](FingerprintApi.md#delete_visitor_data) | **DELETE** /visitors/{visitor_id} | Delete a visitor ID [**get_event**](FingerprintApi.md#get_event) | **GET** /events/{event_id} | Get an event by event ID [**search_events**](FingerprintApi.md#search_events) | **GET** /events | Search events [**update_event**](FingerprintApi.md#update_event) | **PATCH** /events/{event_id} | Update an event +# **analyze_request_for_automation_intelligence** +> EventEdge analyze_request_for_automation_intelligence(edge_request) + +Collect Automation Intelligence. + +The Automation Intelligence API gives you the tools to determine whether traffic is legitimate and should be accepted by your application. + +This feature is currently in a Public Preview testing phase. All feedback is welcome! If you encounter any issues, please [contact our support team](https://fingerprint.com/support/). + +The API detects automation tools like AI Agents, AI Assistants, AI Browsers, and other bots. Additionally, it provides IP intelligence like geolocation, residential proxy, VPN and data center detection. + +Automation Intelligence is derived from HTTP request metadata that reaches your server. It does not require the use of a JavaScript client-side agent or mobile SDKs to collect device context. + +The API is fast, with average response times of less than 30ms, making it a great fit for edge, pre-origin or middleware contexts. The API is platform-agnostic and can be used with different CDN providers, cloud platforms, or any server backend. + +Because this API doesn’t require the use of a client-side device collection agent, it doesn’t support device identification via `visitor_id` and a few Smart Signals derived from deep device telemetry. + +### Event Retrieval + +Events created by the Automation Intelligence API can be fetched via the [`/v4/events/{event_id}`](https://docs.fingerprint.com/reference/server-api-get-event) API using the `event_id` present in the API response. + +Fetch all Automation Intelligence API events via the [`/v4/events?source=edge`](https://docs.fingerprint.com/reference/server-api-search-events#parameter-source) API. + + +### Example + +```python +import os + +import fingerprint_server_sdk +from fingerprint_server_sdk.models.edge_request import EdgeRequest +from fingerprint_server_sdk.models.event_edge import EventEdge +from fingerprint_server_sdk import ApiException, ErrorResponse +from fingerprint_server_sdk.configuration import Region +from pprint import pprint + +# Configure API key authorization and region +configuration = fingerprint_server_sdk.Configuration( + api_key = os.environ["SECRET_API_KEY"], + region = Region.US +) + +# Create an instance of the API class +api_instance = fingerprint_server_sdk.FingerprintApi(configuration) + +edge_request: EdgeRequest = fingerprint_server_sdk.EdgeRequest() # + +try: + # Collect Automation Intelligence. + api_response = api_instance.analyze_request_for_automation_intelligence(edge_request) + print("The response of FingerprintApi->analyze_request_for_automation_intelligence:\n") + pprint(api_response) +except ApiException as e: + if e.body is not None: + error_response = ErrorResponse.from_json(e.body) + if error_response is not None: + message = f"API request failed: {error_response.error.code} {error_response.error.message}" + else: + message = f"API request failed with unexpected error format: {e}" + else: + message = f'Exception when calling FingerprintApi->analyze_request_for_automation_intelligence: {e}' + print(message) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **edge_request** | [**EdgeRequest**](EdgeRequest.md)| | + +### Return type + +[**EventEdge**](EventEdge.md) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | OK. | - | +**400** | Bad request. The request payload is not valid. | - | +**403** | Forbidden. Access to this API is denied. | - | +**413** | Bad request. The request payload is too large. | - | +**429** | Too Many Requests. The request is throttled. | - | +**500** | Workspace error. | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + # **delete_visitor_data** > delete_visitor_data(visitor_id) @@ -63,7 +156,7 @@ configuration = fingerprint_server_sdk.Configuration( # Create an instance of the API class api_instance = fingerprint_server_sdk.FingerprintApi(configuration) -visitor_id: str = 'Ibk1527CUFmcnjLwIs4A9' # The [visitor ID](https://docs.fingerprint.com/reference/js-agent-v4-get-function#visitor_id) you want to delete. +visitor_id: str = 'Ibk1527CUFmcnjLwIs4A9' # The [visitor ID](https://docs.fingerprint.com/reference/js-agent-get-function#visitor_id) you want to delete. try: # Delete a visitor ID @@ -84,7 +177,7 @@ except ApiException as e: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **visitor_id** | **str**| The [visitor ID](https://docs.fingerprint.com/reference/js-agent-v4-get-function#visitor_id) you want to delete. | + **visitor_id** | **str**| The [visitor ID](https://docs.fingerprint.com/reference/js-agent-get-function#visitor_id) you want to delete. | ### Return type @@ -112,10 +205,12 @@ void (empty response body) Get an event by event ID -Get a detailed analysis of an individual identification event, including Smart Signals. +Get a detailed analysis of an individual event, including Smart Signals. Use `event_id` as the URL path parameter. This API method is scoped to a request, i.e. all returned information is by `event_id`. +Use `source` to tell identification events (`device`) from Automation Intelligence events (`edge`). + ### Example @@ -137,7 +232,7 @@ configuration = fingerprint_server_sdk.Configuration( # Create an instance of the API class api_instance = fingerprint_server_sdk.FingerprintApi(configuration) -event_id: str = '1708102555327.NLOjmg' # The unique [identifier](https://docs.fingerprint.com/reference/js-agent-v4-get-function#event_id) of each identification request (`requestId` can be used in its place). +event_id: str = '1708102555327.NLOjmg' # The unique [identifier](https://docs.fingerprint.com/reference/js-agent-get-function#event_id) of each identification request (`requestId` can be used in its place). ruleset_id: str = 'D6N9Kbk9HRWrIWGz' # The ID of the ruleset to evaluate against the event, producing the action to take for this event. The resulting action is returned in the `rule_action` attribute of the response. (optional) try: @@ -161,7 +256,7 @@ except ApiException as e: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **event_id** | **str**| The unique [identifier](https://docs.fingerprint.com/reference/js-agent-v4-get-function#event_id) of each identification request (`requestId` can be used in its place). | + **event_id** | **str**| The unique [identifier](https://docs.fingerprint.com/reference/js-agent-get-function#event_id) of each identification request (`requestId` can be used in its place). | **ruleset_id** | **str**| The ID of the ruleset to evaluate against the event, producing the action to take for this event. The resulting action is returned in the `rule_action` attribute of the response. | [optional] ### Return type @@ -188,7 +283,7 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **search_events** -> EventSearch search_events(limit=limit, pagination_key=pagination_key, visitor_id=visitor_id, high_recall_id=high_recall_id, bot=bot, bot_info=bot_info, bot_info_category=bot_info_category, bot_info_identity=bot_info_identity, bot_info_confidence=bot_info_confidence, bot_info_provider=bot_info_provider, bot_info_name=bot_info_name, ip_address=ip_address, asn=asn, linked_id=linked_id, url=url, bundle_id=bundle_id, package_name=package_name, origin=origin, start=start, end=end, reverse=reverse, suspect=suspect, vpn=vpn, virtual_machine=virtual_machine, tampering=tampering, anti_detect_browser=anti_detect_browser, incognito=incognito, privacy_settings=privacy_settings, jailbroken=jailbroken, frida=frida, factory_reset=factory_reset, cloned_app=cloned_app, emulator=emulator, root_apps=root_apps, vpn_confidence=vpn_confidence, min_suspect_score=min_suspect_score, developer_tools=developer_tools, location_spoofing=location_spoofing, mitm_attack=mitm_attack, rare_device=rare_device, rare_device_percentile_bucket=rare_device_percentile_bucket, proxy=proxy, sdk_version=sdk_version, sdk_platform=sdk_platform, environment=environment, proximity_id=proximity_id, total_hits=total_hits, tor_node=tor_node, incremental_identification_status=incremental_identification_status, simulator=simulator, source=source, active_call=active_call) +> EventSearch search_events(limit=limit, pagination_key=pagination_key, visitor_id=visitor_id, high_recall_id=high_recall_id, bot=bot, bot_info=bot_info, bot_info_category=bot_info_category, bot_info_identity=bot_info_identity, bot_info_confidence=bot_info_confidence, bot_info_provider=bot_info_provider, bot_info_name=bot_info_name, ip_address=ip_address, asn=asn, linked_id=linked_id, url=url, bundle_id=bundle_id, package_name=package_name, origin=origin, start=start, end=end, reverse=reverse, suspect=suspect, vpn=vpn, virtual_machine=virtual_machine, tampering=tampering, anti_detect_browser=anti_detect_browser, incognito=incognito, privacy_settings=privacy_settings, jailbroken=jailbroken, frida=frida, factory_reset=factory_reset, cloned_app=cloned_app, emulator=emulator, root_apps=root_apps, vpn_confidence=vpn_confidence, min_suspect_score=min_suspect_score, developer_tools=developer_tools, location_spoofing=location_spoofing, mitm_attack=mitm_attack, rare_device=rare_device, rare_device_percentile_bucket=rare_device_percentile_bucket, proxy=proxy, sdk_version=sdk_version, sdk_platform=sdk_platform, environment=environment, proximity_id=proximity_id, total_hits=total_hits, tor_node=tor_node, incremental_identification_status=incremental_identification_status, simulator=simulator, active_call=active_call, source=source) Search events @@ -252,7 +347,7 @@ api_instance = fingerprint_server_sdk.FingerprintApi(configuration) limit: int = 10 # Maximum number of events to return. Defaults to 10 when omitted. Results are selected from the time range (`start`, `end`), ordered by `reverse`, then truncated to provided `limit` size. So `reverse=true` returns the oldest N=`limit` events, otherwise the newest N=`limit` events. (optional) pagination_key: str = 'S9rgMMUb4z3X5t5pr_tSgoSZlmyF0O8X7kCV2m981-iY1LmRTjraa1rTk3L-hQExnDWCi0RA-zAIjaVSTNO2AN2eqQWgzT0RjbieMxRfSdkM-HmOhdOgdQvYfPG3vqU1DJKh4Q' # Use `pagination_key` to get the next page of results. When more results are available (e.g., you requested up to 100 results for your query using `limit`, but there are more than 100 events total matching your request), the `pagination_key` field is added to the response. The pagination key is an arbitrary string that should not be interpreted in any way and should be passed as-is. In the following request, use that value in the `pagination_key` parameter to get the next page of results: 1. First request, returning most recent 100 events: `GET api-base-url/events?limit=100` 2. Use `response.pagination_key` to get the next page of results: `GET api-base-url/events?limit=100&pagination_key=S9rgMMUb4z3X5t5pr_tSgoSZlmyF0O8X7kCV2m981-iY1LmRTjraa1rTk3L-hQExnDWCi0RA-zAIjaVSTNO2AN2eqQWgzT0RjbieMxRfSdkM-HmOhdOgdQvYfPG3vqU1DJKh4Q` (optional) -visitor_id: str = 'Ibk1527CUFmcnjLwIs4A9' # Unique [visitor identifier](https://docs.fingerprint.com/reference/js-agent-v4-get-function#visitor_id) issued by Fingerprint Identification and all active Smart Signals. Filter events by matching Visitor ID (`identification.visitor_id` property). (optional) +visitor_id: str = 'Ibk1527CUFmcnjLwIs4A9' # Unique [visitor identifier](https://docs.fingerprint.com/reference/js-agent-get-function#visitor_id) issued by Fingerprint Identification and all active Smart Signals. Filter events by matching Visitor ID (`identification.visitor_id` property). (optional) high_recall_id: str = 'Ibk1527CUFmcnjLwIs4A9' # The High Recall ID is a supplementary browser identifier designed for use cases that require wider coverage over precision. Compared to the standard visitor ID, the High Recall ID strives to match incoming browsers more generously (rather than precisely) with existing browsers and thus identifies fewer browsers as new. The High Recall ID is best suited for use cases that are sensitive to browsers being identified as new and where mismatched browsers are not detrimental. Filter events by matching High Recall ID (`supplementary_id_high_recall.visitor_id` property). (optional) bot: SearchEventsBot = fingerprint_server_sdk.SearchEventsBot() # Filter events by the Bot Detection result, specifically: `all` - events where any kind of bot was detected. `good` - events where a good bot was detected. `bad` - events where a bad bot was detected. `none` - events where no bot was detected. > Note: When using this parameter, only events with the `bot` property set to a valid value are returned. Events without a `bot` Smart Signal result are left out of the response. (optional) bot_info: SearchEventsBotInfo = fingerprint_server_sdk.SearchEventsBotInfo() # Filter events by their Bot Info result, specifically: - `all` - events where any kind of bot was detected. - `none` - events where no bot was detected, and no `bot_info` was present. (optional) @@ -263,7 +358,7 @@ bot_info_provider: List[str] = ['bot_info_provider_example'] # Filter events by bot_info_name: List[str] = ['bot_info_name_example'] # Filter events by their Bot Info Name. The name must match exactly, partial or wildcard matching is not supported. Multiple Names can be provided using the repeated keys syntax. For example, `bot_info_name=ChatGPT%20Agent&bot_info_name=Bedrock%20AgentCore`, will match events with a Bot Info Name of `ChatGPT Agent` or `Bedrock AgentCore`. Other notations like comma-separated or bracket notation are not supported. (optional) ip_address: str = '61.127.217.15' # Filter events by IP address or IP range (if CIDR notation is used). If CIDR notation is not used, a /32 for IPv4 or /128 for IPv6 is assumed. Examples of range based queries: 10.0.0.0/24, 192.168.0.1/32 (optional) asn: str = '12876' # Filter events by the ASN associated with the event's IP address. This corresponds to the `ip_info.(v4|v6).asn` property in the response. (optional) -linked_id: str = 'somelinkedId' # Filter events by your custom identifier. You can use [linked Ids](https://docs.fingerprint.com/reference/js-agent-v4-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. (optional) +linked_id: str = 'somelinkedId' # Filter events by your custom identifier. You can use [linked Ids](https://docs.fingerprint.com/reference/js-agent-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. (optional) url: str = 'https://example.com/login' # Filter events by the URL (`url` property) associated with the event. (optional) bundle_id: str = 'com.example.app' # Filter events by the Bundle ID (iOS) associated with the event. (optional) package_name: str = 'com.example.app' # Filter events by the Package Name (Android) associated with the event. (optional) @@ -300,12 +395,12 @@ total_hits: int = 100 # When set, the response will include a `total_hits` prope tor_node: bool = True # Filter events by Tor Node detection result. > Note: When using this parameter, only events with the `tor_node` property set to `true` or `false` are returned. Events without a `tor_node` detection result are left out of the response. (optional) incremental_identification_status: SearchEventsIncrementalIdentificationStatus = fingerprint_server_sdk.SearchEventsIncrementalIdentificationStatus() # Filter events by their incremental identification status (`incremental_identification_status` property). Non incremental identification events are left out of the response. (optional) simulator: bool = True # Filter events by iOS Simulator Detection result. > Note: When using this parameter, only events with the `simulator` property set to `true` or `false` are returned. Events without a `simulator` Smart Signal result are left out of the response. (optional) -source: List[SearchEventsSource] = [fingerprint_server_sdk.SearchEventsSource()] # Selects the source of events to search. When omitted, only traditional identification events generated from devices are returned (the default behavior). When set to `edge`, only Automation Intelligence (Edge) events are returned. To retrieve all events regardless of source, you must make two requests. One with the `source` parameter set to `edge`, and another with the `source` parameter omitted. > Note: The Automation Intelligence API is in public preview testing phase. If you encounter any issues, please [contact](https://fingerprint.com/support/) our support team. (optional) active_call: bool = True # Filter events by Active Call Detection result on mobile devices. > Note: When using this parameter, only events with the `active_call` property set to `true` or `false` are returned. Events without an `active_call` Smart Signal result are left out of the response. (optional) +source: List[SearchEventsSource] = [fingerprint_server_sdk.SearchEventsSource()] # Selects the source of events to search. When omitted, only traditional identification events generated from devices are returned (the default behavior). When set to `edge`, only Automation Intelligence (Edge) events are returned. To retrieve all events regardless of source, you must make two requests. One with the `source` parameter set to `edge`, and another with the `source` parameter omitted. > Note: The Automation Intelligence API is in public preview testing phase. If you encounter any issues, please [contact](https://fingerprint.com/support/) our support team. (optional) try: # Search events - api_response = api_instance.search_events(limit=limit, pagination_key=pagination_key, visitor_id=visitor_id, high_recall_id=high_recall_id, bot=bot, bot_info=bot_info, bot_info_category=bot_info_category, bot_info_identity=bot_info_identity, bot_info_confidence=bot_info_confidence, bot_info_provider=bot_info_provider, bot_info_name=bot_info_name, ip_address=ip_address, asn=asn, linked_id=linked_id, url=url, bundle_id=bundle_id, package_name=package_name, origin=origin, start=start, end=end, reverse=reverse, suspect=suspect, vpn=vpn, virtual_machine=virtual_machine, tampering=tampering, anti_detect_browser=anti_detect_browser, incognito=incognito, privacy_settings=privacy_settings, jailbroken=jailbroken, frida=frida, factory_reset=factory_reset, cloned_app=cloned_app, emulator=emulator, root_apps=root_apps, vpn_confidence=vpn_confidence, min_suspect_score=min_suspect_score, developer_tools=developer_tools, location_spoofing=location_spoofing, mitm_attack=mitm_attack, rare_device=rare_device, rare_device_percentile_bucket=rare_device_percentile_bucket, proxy=proxy, sdk_version=sdk_version, sdk_platform=sdk_platform, environment=environment, proximity_id=proximity_id, total_hits=total_hits, tor_node=tor_node, incremental_identification_status=incremental_identification_status, simulator=simulator, source=source, active_call=active_call) + api_response = api_instance.search_events(limit=limit, pagination_key=pagination_key, visitor_id=visitor_id, high_recall_id=high_recall_id, bot=bot, bot_info=bot_info, bot_info_category=bot_info_category, bot_info_identity=bot_info_identity, bot_info_confidence=bot_info_confidence, bot_info_provider=bot_info_provider, bot_info_name=bot_info_name, ip_address=ip_address, asn=asn, linked_id=linked_id, url=url, bundle_id=bundle_id, package_name=package_name, origin=origin, start=start, end=end, reverse=reverse, suspect=suspect, vpn=vpn, virtual_machine=virtual_machine, tampering=tampering, anti_detect_browser=anti_detect_browser, incognito=incognito, privacy_settings=privacy_settings, jailbroken=jailbroken, frida=frida, factory_reset=factory_reset, cloned_app=cloned_app, emulator=emulator, root_apps=root_apps, vpn_confidence=vpn_confidence, min_suspect_score=min_suspect_score, developer_tools=developer_tools, location_spoofing=location_spoofing, mitm_attack=mitm_attack, rare_device=rare_device, rare_device_percentile_bucket=rare_device_percentile_bucket, proxy=proxy, sdk_version=sdk_version, sdk_platform=sdk_platform, environment=environment, proximity_id=proximity_id, total_hits=total_hits, tor_node=tor_node, incremental_identification_status=incremental_identification_status, simulator=simulator, active_call=active_call, source=source) print("The response of FingerprintApi->search_events:\n") pprint(api_response) except ApiException as e: @@ -326,7 +421,7 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **limit** | **int**| Maximum number of events to return. Defaults to 10 when omitted. Results are selected from the time range (`start`, `end`), ordered by `reverse`, then truncated to provided `limit` size. So `reverse=true` returns the oldest N=`limit` events, otherwise the newest N=`limit` events. | [optional] **pagination_key** | **str**| Use `pagination_key` to get the next page of results. When more results are available (e.g., you requested up to 100 results for your query using `limit`, but there are more than 100 events total matching your request), the `pagination_key` field is added to the response. The pagination key is an arbitrary string that should not be interpreted in any way and should be passed as-is. In the following request, use that value in the `pagination_key` parameter to get the next page of results: 1. First request, returning most recent 100 events: `GET api-base-url/events?limit=100` 2. Use `response.pagination_key` to get the next page of results: `GET api-base-url/events?limit=100&pagination_key=S9rgMMUb4z3X5t5pr_tSgoSZlmyF0O8X7kCV2m981-iY1LmRTjraa1rTk3L-hQExnDWCi0RA-zAIjaVSTNO2AN2eqQWgzT0RjbieMxRfSdkM-HmOhdOgdQvYfPG3vqU1DJKh4Q` | [optional] - **visitor_id** | **str**| Unique [visitor identifier](https://docs.fingerprint.com/reference/js-agent-v4-get-function#visitor_id) issued by Fingerprint Identification and all active Smart Signals. Filter events by matching Visitor ID (`identification.visitor_id` property). | [optional] + **visitor_id** | **str**| Unique [visitor identifier](https://docs.fingerprint.com/reference/js-agent-get-function#visitor_id) issued by Fingerprint Identification and all active Smart Signals. Filter events by matching Visitor ID (`identification.visitor_id` property). | [optional] **high_recall_id** | **str**| The High Recall ID is a supplementary browser identifier designed for use cases that require wider coverage over precision. Compared to the standard visitor ID, the High Recall ID strives to match incoming browsers more generously (rather than precisely) with existing browsers and thus identifies fewer browsers as new. The High Recall ID is best suited for use cases that are sensitive to browsers being identified as new and where mismatched browsers are not detrimental. Filter events by matching High Recall ID (`supplementary_id_high_recall.visitor_id` property). | [optional] **bot** | [**SearchEventsBot**](.md)| Filter events by the Bot Detection result, specifically: `all` - events where any kind of bot was detected. `good` - events where a good bot was detected. `bad` - events where a bad bot was detected. `none` - events where no bot was detected. > Note: When using this parameter, only events with the `bot` property set to a valid value are returned. Events without a `bot` Smart Signal result are left out of the response. | [optional] **bot_info** | [**SearchEventsBotInfo**](.md)| Filter events by their Bot Info result, specifically: - `all` - events where any kind of bot was detected. - `none` - events where no bot was detected, and no `bot_info` was present. | [optional] @@ -337,7 +432,7 @@ Name | Type | Description | Notes **bot_info_name** | [**List[str]**](str.md)| Filter events by their Bot Info Name. The name must match exactly, partial or wildcard matching is not supported. Multiple Names can be provided using the repeated keys syntax. For example, `bot_info_name=ChatGPT%20Agent&bot_info_name=Bedrock%20AgentCore`, will match events with a Bot Info Name of `ChatGPT Agent` or `Bedrock AgentCore`. Other notations like comma-separated or bracket notation are not supported. | [optional] **ip_address** | **str**| Filter events by IP address or IP range (if CIDR notation is used). If CIDR notation is not used, a /32 for IPv4 or /128 for IPv6 is assumed. Examples of range based queries: 10.0.0.0/24, 192.168.0.1/32 | [optional] **asn** | **str**| Filter events by the ASN associated with the event's IP address. This corresponds to the `ip_info.(v4|v6).asn` property in the response. | [optional] - **linked_id** | **str**| Filter events by your custom identifier. You can use [linked Ids](https://docs.fingerprint.com/reference/js-agent-v4-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. | [optional] + **linked_id** | **str**| Filter events by your custom identifier. You can use [linked Ids](https://docs.fingerprint.com/reference/js-agent-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. | [optional] **url** | **str**| Filter events by the URL (`url` property) associated with the event. | [optional] **bundle_id** | **str**| Filter events by the Bundle ID (iOS) associated with the event. | [optional] **package_name** | **str**| Filter events by the Package Name (Android) associated with the event. | [optional] @@ -374,8 +469,8 @@ Name | Type | Description | Notes **tor_node** | **bool**| Filter events by Tor Node detection result. > Note: When using this parameter, only events with the `tor_node` property set to `true` or `false` are returned. Events without a `tor_node` detection result are left out of the response. | [optional] **incremental_identification_status** | [**SearchEventsIncrementalIdentificationStatus**](.md)| Filter events by their incremental identification status (`incremental_identification_status` property). Non incremental identification events are left out of the response. | [optional] **simulator** | **bool**| Filter events by iOS Simulator Detection result. > Note: When using this parameter, only events with the `simulator` property set to `true` or `false` are returned. Events without a `simulator` Smart Signal result are left out of the response. | [optional] - **source** | [**List[SearchEventsSource]**](SearchEventsSource.md)| Selects the source of events to search. When omitted, only traditional identification events generated from devices are returned (the default behavior). When set to `edge`, only Automation Intelligence (Edge) events are returned. To retrieve all events regardless of source, you must make two requests. One with the `source` parameter set to `edge`, and another with the `source` parameter omitted. > Note: The Automation Intelligence API is in public preview testing phase. If you encounter any issues, please [contact](https://fingerprint.com/support/) our support team. | [optional] **active_call** | **bool**| Filter events by Active Call Detection result on mobile devices. > Note: When using this parameter, only events with the `active_call` property set to `true` or `false` are returned. Events without an `active_call` Smart Signal result are left out of the response. | [optional] + **source** | [**List[SearchEventsSource]**](SearchEventsSource.md)| Selects the source of events to search. When omitted, only traditional identification events generated from devices are returned (the default behavior). When set to `edge`, only Automation Intelligence (Edge) events are returned. To retrieve all events regardless of source, you must make two requests. One with the `source` parameter set to `edge`, and another with the `source` parameter omitted. > Note: The Automation Intelligence API is in public preview testing phase. If you encounter any issues, please [contact](https://fingerprint.com/support/) our support team. | [optional] ### Return type @@ -436,7 +531,7 @@ configuration = fingerprint_server_sdk.Configuration( # Create an instance of the API class api_instance = fingerprint_server_sdk.FingerprintApi(configuration) -event_id: str = '1708102555327.NLOjmg' # The unique event [identifier](https://docs.fingerprint.com/reference/js-agent-v4-get-function#event_id). +event_id: str = '1708102555327.NLOjmg' # The unique event [identifier](https://docs.fingerprint.com/reference/js-agent-get-function#event_id). event_update: EventUpdate = fingerprint_server_sdk.EventUpdate() # try: @@ -458,7 +553,7 @@ except ApiException as e: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **event_id** | **str**| The unique event [identifier](https://docs.fingerprint.com/reference/js-agent-v4-get-function#event_id). | + **event_id** | **str**| The unique event [identifier](https://docs.fingerprint.com/reference/js-agent-get-function#event_id). | **event_update** | [**EventUpdate**](EventUpdate.md)| | ### Return type diff --git a/fingerprint_server_sdk/__init__.py b/fingerprint_server_sdk/__init__.py index afa630bd..81d9a515 100644 --- a/fingerprint_server_sdk/__init__.py +++ b/fingerprint_server_sdk/__init__.py @@ -50,11 +50,14 @@ 'BotResult', 'BrowserDetails', 'Canvas', + 'EdgeRequest', + 'EdgeRequestHeadersInner', 'Emoji', 'Error', 'ErrorCode', 'ErrorResponse', 'Event', + 'EventEdge', 'EventRuleAction', 'EventRuleActionAllow', 'EventRuleActionBlock', @@ -137,11 +140,14 @@ from fingerprint_server_sdk.models.bot_result import BotResult from fingerprint_server_sdk.models.browser_details import BrowserDetails from fingerprint_server_sdk.models.canvas import Canvas +from fingerprint_server_sdk.models.edge_request import EdgeRequest +from fingerprint_server_sdk.models.edge_request_headers_inner import EdgeRequestHeadersInner from fingerprint_server_sdk.models.emoji import Emoji from fingerprint_server_sdk.models.error import Error from fingerprint_server_sdk.models.error_code import ErrorCode from fingerprint_server_sdk.models.error_response import ErrorResponse from fingerprint_server_sdk.models.event import Event +from fingerprint_server_sdk.models.event_edge import EventEdge from fingerprint_server_sdk.models.event_rule_action import EventRuleAction from fingerprint_server_sdk.models.event_rule_action_allow import EventRuleActionAllow from fingerprint_server_sdk.models.event_rule_action_block import EventRuleActionBlock diff --git a/fingerprint_server_sdk/api/fingerprint_api.py b/fingerprint_server_sdk/api/fingerprint_api.py index eb22c9f2..04113e68 100644 --- a/fingerprint_server_sdk/api/fingerprint_api.py +++ b/fingerprint_server_sdk/api/fingerprint_api.py @@ -22,7 +22,9 @@ from fingerprint_server_sdk.models.bot_info_category import BotInfoCategory from fingerprint_server_sdk.models.bot_info_confidence import BotInfoConfidence from fingerprint_server_sdk.models.bot_info_identity import BotInfoIdentity +from fingerprint_server_sdk.models.edge_request import EdgeRequest from fingerprint_server_sdk.models.event import Event +from fingerprint_server_sdk.models.event_edge import EventEdge from fingerprint_server_sdk.models.event_search import EventSearch from fingerprint_server_sdk.models.event_update import EventUpdate from fingerprint_server_sdk.models.search_events_bot import SearchEventsBot @@ -65,13 +67,244 @@ class FingerprintApi: def __init__(self, configuration: Configuration) -> None: self.api_client = ApiClient(configuration) + @validate_call + def analyze_request_for_automation_intelligence( + self, + edge_request: EdgeRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]], + ] = None, + _request_auth: Optional[dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[dict[StrictStr, Any]] = None, + ) -> EventEdge: + """Collect Automation Intelligence. + + The Automation Intelligence API gives you the tools to determine whether traffic is legitimate and should be accepted by your application. This feature is currently in a Public Preview testing phase. All feedback is welcome! If you encounter any issues, please [contact our support team](https://fingerprint.com/support/). The API detects automation tools like AI Agents, AI Assistants, AI Browsers, and other bots. Additionally, it provides IP intelligence like geolocation, residential proxy, VPN and data center detection. Automation Intelligence is derived from HTTP request metadata that reaches your server. It does not require the use of a JavaScript client-side agent or mobile SDKs to collect device context. The API is fast, with average response times of less than 30ms, making it a great fit for edge, pre-origin or middleware contexts. The API is platform-agnostic and can be used with different CDN providers, cloud platforms, or any server backend. Because this API doesn’t require the use of a client-side device collection agent, it doesn’t support device identification via `visitor_id` and a few Smart Signals derived from deep device telemetry. ### Event Retrieval Events created by the Automation Intelligence API can be fetched via the [`/v4/events/{event_id}`](https://docs.fingerprint.com/reference/server-api-get-event) API using the `event_id` present in the API response. Fetch all Automation Intelligence API events via the [`/v4/events?source=edge`](https://docs.fingerprint.com/reference/server-api-search-events#parameter-source) API. + + :param edge_request: (required) + :type edge_request: EdgeRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._analyze_request_for_automation_intelligence_serialize( + edge_request=edge_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + ) + + _response_types_map: dict[str, Optional[str]] = { + '200': 'EventEdge', + '400': 'ErrorResponse', + '403': 'ErrorResponse', + '413': 'ErrorResponse', + '429': 'ErrorResponse', + '500': 'ErrorResponse', + } + + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call + def analyze_request_for_automation_intelligence_with_http_info( + self, + edge_request: EdgeRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]], + ] = None, + _request_auth: Optional[dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[dict[StrictStr, Any]] = None, + ) -> ApiResponse[EventEdge]: + """Collect Automation Intelligence. + + The Automation Intelligence API gives you the tools to determine whether traffic is legitimate and should be accepted by your application. This feature is currently in a Public Preview testing phase. All feedback is welcome! If you encounter any issues, please [contact our support team](https://fingerprint.com/support/). The API detects automation tools like AI Agents, AI Assistants, AI Browsers, and other bots. Additionally, it provides IP intelligence like geolocation, residential proxy, VPN and data center detection. Automation Intelligence is derived from HTTP request metadata that reaches your server. It does not require the use of a JavaScript client-side agent or mobile SDKs to collect device context. The API is fast, with average response times of less than 30ms, making it a great fit for edge, pre-origin or middleware contexts. The API is platform-agnostic and can be used with different CDN providers, cloud platforms, or any server backend. Because this API doesn’t require the use of a client-side device collection agent, it doesn’t support device identification via `visitor_id` and a few Smart Signals derived from deep device telemetry. ### Event Retrieval Events created by the Automation Intelligence API can be fetched via the [`/v4/events/{event_id}`](https://docs.fingerprint.com/reference/server-api-get-event) API using the `event_id` present in the API response. Fetch all Automation Intelligence API events via the [`/v4/events?source=edge`](https://docs.fingerprint.com/reference/server-api-search-events#parameter-source) API. + + :param edge_request: (required) + :type edge_request: EdgeRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._analyze_request_for_automation_intelligence_serialize( + edge_request=edge_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + ) + + _response_types_map: dict[str, Optional[str]] = { + '200': 'EventEdge', + '400': 'ErrorResponse', + '403': 'ErrorResponse', + '413': 'ErrorResponse', + '429': 'ErrorResponse', + '500': 'ErrorResponse', + } + + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + def analyze_request_for_automation_intelligence_without_preload_content( + self, + edge_request: EdgeRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]], + ] = None, + _request_auth: Optional[dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[dict[StrictStr, Any]] = None, + ) -> RESTResponseType: + """Collect Automation Intelligence. + + The Automation Intelligence API gives you the tools to determine whether traffic is legitimate and should be accepted by your application. This feature is currently in a Public Preview testing phase. All feedback is welcome! If you encounter any issues, please [contact our support team](https://fingerprint.com/support/). The API detects automation tools like AI Agents, AI Assistants, AI Browsers, and other bots. Additionally, it provides IP intelligence like geolocation, residential proxy, VPN and data center detection. Automation Intelligence is derived from HTTP request metadata that reaches your server. It does not require the use of a JavaScript client-side agent or mobile SDKs to collect device context. The API is fast, with average response times of less than 30ms, making it a great fit for edge, pre-origin or middleware contexts. The API is platform-agnostic and can be used with different CDN providers, cloud platforms, or any server backend. Because this API doesn’t require the use of a client-side device collection agent, it doesn’t support device identification via `visitor_id` and a few Smart Signals derived from deep device telemetry. ### Event Retrieval Events created by the Automation Intelligence API can be fetched via the [`/v4/events/{event_id}`](https://docs.fingerprint.com/reference/server-api-get-event) API using the `event_id` present in the API response. Fetch all Automation Intelligence API events via the [`/v4/events?source=edge`](https://docs.fingerprint.com/reference/server-api-search-events#parameter-source) API. + + :param edge_request: (required) + :type edge_request: EdgeRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._analyze_request_for_automation_intelligence_serialize( + edge_request=edge_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + ) + + _response_types_map: dict[str, Optional[str]] = { + '200': 'EventEdge', + '400': 'ErrorResponse', + '403': 'ErrorResponse', + '413': 'ErrorResponse', + '429': 'ErrorResponse', + '500': 'ErrorResponse', + } + + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + return response_data.response + + def _analyze_request_for_automation_intelligence_serialize( + self, + edge_request: EdgeRequest, + _request_auth: Optional[dict[StrictStr, Any]], + _content_type: Optional[StrictStr], + _headers: Optional[dict[StrictStr, Any]], + ) -> RequestSerialized: + + _collection_formats: dict[str, str] = {} + + _path_params: dict[str, str] = {} + _query_params: list[tuple[str, ParamValue]] = [] + _header_params: dict[str, Optional[str]] = _headers or {} + _form_params: list[tuple[str, ParamValue]] = [] + _files: dict[ + str, + Union[str, bytes, list[str], list[bytes], tuple[str, bytes], list[tuple[str, bytes]]], + ] = {} + _body_params: Optional[Any] = None + + # process the body parameter + if edge_request is not None: + _body_params = edge_request + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept(['application/json']) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = self.api_client.select_header_content_type( + ['application/json'] + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: list[str] = ['bearerAuth'] + + return self.api_client.param_serialize( + method='POST', + resource_path='/edge', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _request_auth=_request_auth, + ) + @validate_call def delete_visitor_data( self, visitor_id: Annotated[ StrictStr, Field( - description='The [visitor ID](https://docs.fingerprint.com/reference/js-agent-v4-get-function#visitor_id) you want to delete.' + description='The [visitor ID](https://docs.fingerprint.com/reference/js-agent-get-function#visitor_id) you want to delete.' ), ], _request_timeout: Union[ @@ -87,7 +320,7 @@ def delete_visitor_data( Use this API to request the deletion of all data associated with a specific visitor ID. Upon a request to delete data for a visitor ID, - The data collected from the corresponding browser (or device) will be deleted asynchronously, typically within a few minutes. This data will no longer be available to identify this browser (or device). When the same browser (or device) revisits, it will receive a new visitor ID. - The identification events made from this browser (or device) in the past 10 days are typically deleted within 24 hrs. - The identification events made from this browser (or device) outside of the 10 days will be purged as per your [data retention period](https://docs.fingerprint.com/docs/regions#data-retention). The following timeline illustrates which events are deleted and which remain after a DELETE API request: ``` Day 1: First visit from browser A. (Assigned visitor ID: VID1000) Day 2: Browser A revisits. (Assigned the same visitor ID: VID1000) Day 13: Browser A revisits. (Assigned the same visitor ID: VID1000) Day 14: Delete VID1000 Day 15: Browser A re-visits. (Assigned a different visitor ID: VID9999) Day 15: GET /events/day-13 (Returns 404. The event is within the 10 days of deleting VID1000 and will have been deleted) Day 16: GET /events/day-2 (Returns 200. The event is outside of the 10 days of deleting VID1000 and is still available) ``` ### Availability This API is available only for Enterprise plans **upon request**. If you are interested, please [contact our support team](https://fingerprint.com/support/). ### Rate limits and daily quota The rate limits and daily quota for this API **differ** from those for our other API. The maximum number of DELETE requests that can be made in an hour cannot exceed 30 RPH, and the maximum number that can be made in a day cannot exceed 500 RPD. You can request an increase to these limits by contacting [our support team](https://fingerprint.com/support/). - :param visitor_id: The [visitor ID](https://docs.fingerprint.com/reference/js-agent-v4-get-function#visitor_id) you want to delete. (required) + :param visitor_id: The [visitor ID](https://docs.fingerprint.com/reference/js-agent-get-function#visitor_id) you want to delete. (required) :type visitor_id: str :param _request_timeout: timeout setting for this request. If one number provided, it will be total request @@ -135,7 +368,7 @@ def delete_visitor_data_with_http_info( visitor_id: Annotated[ StrictStr, Field( - description='The [visitor ID](https://docs.fingerprint.com/reference/js-agent-v4-get-function#visitor_id) you want to delete.' + description='The [visitor ID](https://docs.fingerprint.com/reference/js-agent-get-function#visitor_id) you want to delete.' ), ], _request_timeout: Union[ @@ -151,7 +384,7 @@ def delete_visitor_data_with_http_info( Use this API to request the deletion of all data associated with a specific visitor ID. Upon a request to delete data for a visitor ID, - The data collected from the corresponding browser (or device) will be deleted asynchronously, typically within a few minutes. This data will no longer be available to identify this browser (or device). When the same browser (or device) revisits, it will receive a new visitor ID. - The identification events made from this browser (or device) in the past 10 days are typically deleted within 24 hrs. - The identification events made from this browser (or device) outside of the 10 days will be purged as per your [data retention period](https://docs.fingerprint.com/docs/regions#data-retention). The following timeline illustrates which events are deleted and which remain after a DELETE API request: ``` Day 1: First visit from browser A. (Assigned visitor ID: VID1000) Day 2: Browser A revisits. (Assigned the same visitor ID: VID1000) Day 13: Browser A revisits. (Assigned the same visitor ID: VID1000) Day 14: Delete VID1000 Day 15: Browser A re-visits. (Assigned a different visitor ID: VID9999) Day 15: GET /events/day-13 (Returns 404. The event is within the 10 days of deleting VID1000 and will have been deleted) Day 16: GET /events/day-2 (Returns 200. The event is outside of the 10 days of deleting VID1000 and is still available) ``` ### Availability This API is available only for Enterprise plans **upon request**. If you are interested, please [contact our support team](https://fingerprint.com/support/). ### Rate limits and daily quota The rate limits and daily quota for this API **differ** from those for our other API. The maximum number of DELETE requests that can be made in an hour cannot exceed 30 RPH, and the maximum number that can be made in a day cannot exceed 500 RPD. You can request an increase to these limits by contacting [our support team](https://fingerprint.com/support/). - :param visitor_id: The [visitor ID](https://docs.fingerprint.com/reference/js-agent-v4-get-function#visitor_id) you want to delete. (required) + :param visitor_id: The [visitor ID](https://docs.fingerprint.com/reference/js-agent-get-function#visitor_id) you want to delete. (required) :type visitor_id: str :param _request_timeout: timeout setting for this request. If one number provided, it will be total request @@ -199,7 +432,7 @@ def delete_visitor_data_without_preload_content( visitor_id: Annotated[ StrictStr, Field( - description='The [visitor ID](https://docs.fingerprint.com/reference/js-agent-v4-get-function#visitor_id) you want to delete.' + description='The [visitor ID](https://docs.fingerprint.com/reference/js-agent-get-function#visitor_id) you want to delete.' ), ], _request_timeout: Union[ @@ -215,7 +448,7 @@ def delete_visitor_data_without_preload_content( Use this API to request the deletion of all data associated with a specific visitor ID. Upon a request to delete data for a visitor ID, - The data collected from the corresponding browser (or device) will be deleted asynchronously, typically within a few minutes. This data will no longer be available to identify this browser (or device). When the same browser (or device) revisits, it will receive a new visitor ID. - The identification events made from this browser (or device) in the past 10 days are typically deleted within 24 hrs. - The identification events made from this browser (or device) outside of the 10 days will be purged as per your [data retention period](https://docs.fingerprint.com/docs/regions#data-retention). The following timeline illustrates which events are deleted and which remain after a DELETE API request: ``` Day 1: First visit from browser A. (Assigned visitor ID: VID1000) Day 2: Browser A revisits. (Assigned the same visitor ID: VID1000) Day 13: Browser A revisits. (Assigned the same visitor ID: VID1000) Day 14: Delete VID1000 Day 15: Browser A re-visits. (Assigned a different visitor ID: VID9999) Day 15: GET /events/day-13 (Returns 404. The event is within the 10 days of deleting VID1000 and will have been deleted) Day 16: GET /events/day-2 (Returns 200. The event is outside of the 10 days of deleting VID1000 and is still available) ``` ### Availability This API is available only for Enterprise plans **upon request**. If you are interested, please [contact our support team](https://fingerprint.com/support/). ### Rate limits and daily quota The rate limits and daily quota for this API **differ** from those for our other API. The maximum number of DELETE requests that can be made in an hour cannot exceed 30 RPH, and the maximum number that can be made in a day cannot exceed 500 RPD. You can request an increase to these limits by contacting [our support team](https://fingerprint.com/support/). - :param visitor_id: The [visitor ID](https://docs.fingerprint.com/reference/js-agent-v4-get-function#visitor_id) you want to delete. (required) + :param visitor_id: The [visitor ID](https://docs.fingerprint.com/reference/js-agent-get-function#visitor_id) you want to delete. (required) :type visitor_id: str :param _request_timeout: timeout setting for this request. If one number provided, it will be total request @@ -304,7 +537,7 @@ def get_event( event_id: Annotated[ StrictStr, Field( - description='The unique [identifier](https://docs.fingerprint.com/reference/js-agent-v4-get-function#event_id) of each identification request (`requestId` can be used in its place).' + description='The unique [identifier](https://docs.fingerprint.com/reference/js-agent-get-function#event_id) of each identification request (`requestId` can be used in its place).' ), ], ruleset_id: Annotated[ @@ -324,9 +557,9 @@ def get_event( ) -> Event: """Get an event by event ID - Get a detailed analysis of an individual identification event, including Smart Signals. Use `event_id` as the URL path parameter. This API method is scoped to a request, i.e. all returned information is by `event_id`. + Get a detailed analysis of an individual event, including Smart Signals. Use `event_id` as the URL path parameter. This API method is scoped to a request, i.e. all returned information is by `event_id`. Use `source` to tell identification events (`device`) from Automation Intelligence events (`edge`). - :param event_id: The unique [identifier](https://docs.fingerprint.com/reference/js-agent-v4-get-function#event_id) of each identification request (`requestId` can be used in its place). (required) + :param event_id: The unique [identifier](https://docs.fingerprint.com/reference/js-agent-get-function#event_id) of each identification request (`requestId` can be used in its place). (required) :type event_id: str :param ruleset_id: The ID of the ruleset to evaluate against the event, producing the action to take for this event. The resulting action is returned in the `rule_action` attribute of the response. :type ruleset_id: str @@ -379,7 +612,7 @@ def get_event_with_http_info( event_id: Annotated[ StrictStr, Field( - description='The unique [identifier](https://docs.fingerprint.com/reference/js-agent-v4-get-function#event_id) of each identification request (`requestId` can be used in its place).' + description='The unique [identifier](https://docs.fingerprint.com/reference/js-agent-get-function#event_id) of each identification request (`requestId` can be used in its place).' ), ], ruleset_id: Annotated[ @@ -399,9 +632,9 @@ def get_event_with_http_info( ) -> ApiResponse[Event]: """Get an event by event ID - Get a detailed analysis of an individual identification event, including Smart Signals. Use `event_id` as the URL path parameter. This API method is scoped to a request, i.e. all returned information is by `event_id`. + Get a detailed analysis of an individual event, including Smart Signals. Use `event_id` as the URL path parameter. This API method is scoped to a request, i.e. all returned information is by `event_id`. Use `source` to tell identification events (`device`) from Automation Intelligence events (`edge`). - :param event_id: The unique [identifier](https://docs.fingerprint.com/reference/js-agent-v4-get-function#event_id) of each identification request (`requestId` can be used in its place). (required) + :param event_id: The unique [identifier](https://docs.fingerprint.com/reference/js-agent-get-function#event_id) of each identification request (`requestId` can be used in its place). (required) :type event_id: str :param ruleset_id: The ID of the ruleset to evaluate against the event, producing the action to take for this event. The resulting action is returned in the `rule_action` attribute of the response. :type ruleset_id: str @@ -454,7 +687,7 @@ def get_event_without_preload_content( event_id: Annotated[ StrictStr, Field( - description='The unique [identifier](https://docs.fingerprint.com/reference/js-agent-v4-get-function#event_id) of each identification request (`requestId` can be used in its place).' + description='The unique [identifier](https://docs.fingerprint.com/reference/js-agent-get-function#event_id) of each identification request (`requestId` can be used in its place).' ), ], ruleset_id: Annotated[ @@ -474,9 +707,9 @@ def get_event_without_preload_content( ) -> RESTResponseType: """Get an event by event ID - Get a detailed analysis of an individual identification event, including Smart Signals. Use `event_id` as the URL path parameter. This API method is scoped to a request, i.e. all returned information is by `event_id`. + Get a detailed analysis of an individual event, including Smart Signals. Use `event_id` as the URL path parameter. This API method is scoped to a request, i.e. all returned information is by `event_id`. Use `source` to tell identification events (`device`) from Automation Intelligence events (`edge`). - :param event_id: The unique [identifier](https://docs.fingerprint.com/reference/js-agent-v4-get-function#event_id) of each identification request (`requestId` can be used in its place). (required) + :param event_id: The unique [identifier](https://docs.fingerprint.com/reference/js-agent-get-function#event_id) of each identification request (`requestId` can be used in its place). (required) :type event_id: str :param ruleset_id: The ID of the ruleset to evaluate against the event, producing the action to take for this event. The resulting action is returned in the `rule_action` attribute of the response. :type ruleset_id: str @@ -587,7 +820,7 @@ def search_events( visitor_id: Annotated[ Optional[StrictStr], Field( - description='Unique [visitor identifier](https://docs.fingerprint.com/reference/js-agent-v4-get-function#visitor_id) issued by Fingerprint Identification and all active Smart Signals. Filter events by matching Visitor ID (`identification.visitor_id` property). ' + description='Unique [visitor identifier](https://docs.fingerprint.com/reference/js-agent-get-function#visitor_id) issued by Fingerprint Identification and all active Smart Signals. Filter events by matching Visitor ID (`identification.visitor_id` property). ' ), ] = None, high_recall_id: Annotated[ @@ -653,7 +886,7 @@ def search_events( linked_id: Annotated[ Optional[StrictStr], Field( - description='Filter events by your custom identifier. You can use [linked Ids](https://docs.fingerprint.com/reference/js-agent-v4-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. ' + description='Filter events by your custom identifier. You can use [linked Ids](https://docs.fingerprint.com/reference/js-agent-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. ' ), ] = None, url: Annotated[ @@ -870,18 +1103,18 @@ def search_events( description='Filter events by iOS Simulator Detection result. > Note: When using this parameter, only events with the `simulator` property set to `true` or `false` are returned. Events without a `simulator` Smart Signal result are left out of the response. ' ), ] = None, - source: Annotated[ - Optional[Annotated[list[SearchEventsSource], Field(max_length=1)]], - Field( - description='Selects the source of events to search. When omitted, only traditional identification events generated from devices are returned (the default behavior). When set to `edge`, only Automation Intelligence (Edge) events are returned. To retrieve all events regardless of source, you must make two requests. One with the `source` parameter set to `edge`, and another with the `source` parameter omitted. > Note: The Automation Intelligence API is in public preview testing phase. If you encounter any issues, please [contact](https://fingerprint.com/support/) our support team. ' - ), - ] = None, active_call: Annotated[ Optional[StrictBool], Field( description='Filter events by Active Call Detection result on mobile devices. > Note: When using this parameter, only events with the `active_call` property set to `true` or `false` are returned. Events without an `active_call` Smart Signal result are left out of the response. ' ), ] = None, + source: Annotated[ + Optional[Annotated[list[SearchEventsSource], Field(max_length=1)]], + Field( + description='Selects the source of events to search. When omitted, only traditional identification events generated from devices are returned (the default behavior). When set to `edge`, only Automation Intelligence (Edge) events are returned. To retrieve all events regardless of source, you must make two requests. One with the `source` parameter set to `edge`, and another with the `source` parameter omitted. > Note: The Automation Intelligence API is in public preview testing phase. If you encounter any issues, please [contact](https://fingerprint.com/support/) our support team. ' + ), + ] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -899,7 +1132,7 @@ def search_events( :type limit: int :param pagination_key: Use `pagination_key` to get the next page of results. When more results are available (e.g., you requested up to 100 results for your query using `limit`, but there are more than 100 events total matching your request), the `pagination_key` field is added to the response. The pagination key is an arbitrary string that should not be interpreted in any way and should be passed as-is. In the following request, use that value in the `pagination_key` parameter to get the next page of results: 1. First request, returning most recent 100 events: `GET api-base-url/events?limit=100` 2. Use `response.pagination_key` to get the next page of results: `GET api-base-url/events?limit=100&pagination_key=S9rgMMUb4z3X5t5pr_tSgoSZlmyF0O8X7kCV2m981-iY1LmRTjraa1rTk3L-hQExnDWCi0RA-zAIjaVSTNO2AN2eqQWgzT0RjbieMxRfSdkM-HmOhdOgdQvYfPG3vqU1DJKh4Q` :type pagination_key: str - :param visitor_id: Unique [visitor identifier](https://docs.fingerprint.com/reference/js-agent-v4-get-function#visitor_id) issued by Fingerprint Identification and all active Smart Signals. Filter events by matching Visitor ID (`identification.visitor_id` property). + :param visitor_id: Unique [visitor identifier](https://docs.fingerprint.com/reference/js-agent-get-function#visitor_id) issued by Fingerprint Identification and all active Smart Signals. Filter events by matching Visitor ID (`identification.visitor_id` property). :type visitor_id: str :param high_recall_id: The High Recall ID is a supplementary browser identifier designed for use cases that require wider coverage over precision. Compared to the standard visitor ID, the High Recall ID strives to match incoming browsers more generously (rather than precisely) with existing browsers and thus identifies fewer browsers as new. The High Recall ID is best suited for use cases that are sensitive to browsers being identified as new and where mismatched browsers are not detrimental. Filter events by matching High Recall ID (`supplementary_id_high_recall.visitor_id` property). :type high_recall_id: str @@ -921,7 +1154,7 @@ def search_events( :type ip_address: str :param asn: Filter events by the ASN associated with the event's IP address. This corresponds to the `ip_info.(v4|v6).asn` property in the response. :type asn: str - :param linked_id: Filter events by your custom identifier. You can use [linked Ids](https://docs.fingerprint.com/reference/js-agent-v4-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. + :param linked_id: Filter events by your custom identifier. You can use [linked Ids](https://docs.fingerprint.com/reference/js-agent-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. :type linked_id: str :param url: Filter events by the URL (`url` property) associated with the event. :type url: str @@ -995,10 +1228,10 @@ def search_events( :type incremental_identification_status: SearchEventsIncrementalIdentificationStatus :param simulator: Filter events by iOS Simulator Detection result. > Note: When using this parameter, only events with the `simulator` property set to `true` or `false` are returned. Events without a `simulator` Smart Signal result are left out of the response. :type simulator: bool - :param source: Selects the source of events to search. When omitted, only traditional identification events generated from devices are returned (the default behavior). When set to `edge`, only Automation Intelligence (Edge) events are returned. To retrieve all events regardless of source, you must make two requests. One with the `source` parameter set to `edge`, and another with the `source` parameter omitted. > Note: The Automation Intelligence API is in public preview testing phase. If you encounter any issues, please [contact](https://fingerprint.com/support/) our support team. - :type source: List[SearchEventsSource] :param active_call: Filter events by Active Call Detection result on mobile devices. > Note: When using this parameter, only events with the `active_call` property set to `true` or `false` are returned. Events without an `active_call` Smart Signal result are left out of the response. :type active_call: bool + :param source: Selects the source of events to search. When omitted, only traditional identification events generated from devices are returned (the default behavior). When set to `edge`, only Automation Intelligence (Edge) events are returned. To retrieve all events regardless of source, you must make two requests. One with the `source` parameter set to `edge`, and another with the `source` parameter omitted. > Note: The Automation Intelligence API is in public preview testing phase. If you encounter any issues, please [contact](https://fingerprint.com/support/) our support team. + :type source: List[SearchEventsSource] :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -1068,8 +1301,8 @@ def search_events( tor_node=tor_node, incremental_identification_status=incremental_identification_status, simulator=simulator, - source=source, active_call=active_call, + source=source, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -1110,7 +1343,7 @@ def search_events_with_http_info( visitor_id: Annotated[ Optional[StrictStr], Field( - description='Unique [visitor identifier](https://docs.fingerprint.com/reference/js-agent-v4-get-function#visitor_id) issued by Fingerprint Identification and all active Smart Signals. Filter events by matching Visitor ID (`identification.visitor_id` property). ' + description='Unique [visitor identifier](https://docs.fingerprint.com/reference/js-agent-get-function#visitor_id) issued by Fingerprint Identification and all active Smart Signals. Filter events by matching Visitor ID (`identification.visitor_id` property). ' ), ] = None, high_recall_id: Annotated[ @@ -1176,7 +1409,7 @@ def search_events_with_http_info( linked_id: Annotated[ Optional[StrictStr], Field( - description='Filter events by your custom identifier. You can use [linked Ids](https://docs.fingerprint.com/reference/js-agent-v4-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. ' + description='Filter events by your custom identifier. You can use [linked Ids](https://docs.fingerprint.com/reference/js-agent-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. ' ), ] = None, url: Annotated[ @@ -1393,18 +1626,18 @@ def search_events_with_http_info( description='Filter events by iOS Simulator Detection result. > Note: When using this parameter, only events with the `simulator` property set to `true` or `false` are returned. Events without a `simulator` Smart Signal result are left out of the response. ' ), ] = None, - source: Annotated[ - Optional[Annotated[list[SearchEventsSource], Field(max_length=1)]], - Field( - description='Selects the source of events to search. When omitted, only traditional identification events generated from devices are returned (the default behavior). When set to `edge`, only Automation Intelligence (Edge) events are returned. To retrieve all events regardless of source, you must make two requests. One with the `source` parameter set to `edge`, and another with the `source` parameter omitted. > Note: The Automation Intelligence API is in public preview testing phase. If you encounter any issues, please [contact](https://fingerprint.com/support/) our support team. ' - ), - ] = None, active_call: Annotated[ Optional[StrictBool], Field( description='Filter events by Active Call Detection result on mobile devices. > Note: When using this parameter, only events with the `active_call` property set to `true` or `false` are returned. Events without an `active_call` Smart Signal result are left out of the response. ' ), ] = None, + source: Annotated[ + Optional[Annotated[list[SearchEventsSource], Field(max_length=1)]], + Field( + description='Selects the source of events to search. When omitted, only traditional identification events generated from devices are returned (the default behavior). When set to `edge`, only Automation Intelligence (Edge) events are returned. To retrieve all events regardless of source, you must make two requests. One with the `source` parameter set to `edge`, and another with the `source` parameter omitted. > Note: The Automation Intelligence API is in public preview testing phase. If you encounter any issues, please [contact](https://fingerprint.com/support/) our support team. ' + ), + ] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -1422,7 +1655,7 @@ def search_events_with_http_info( :type limit: int :param pagination_key: Use `pagination_key` to get the next page of results. When more results are available (e.g., you requested up to 100 results for your query using `limit`, but there are more than 100 events total matching your request), the `pagination_key` field is added to the response. The pagination key is an arbitrary string that should not be interpreted in any way and should be passed as-is. In the following request, use that value in the `pagination_key` parameter to get the next page of results: 1. First request, returning most recent 100 events: `GET api-base-url/events?limit=100` 2. Use `response.pagination_key` to get the next page of results: `GET api-base-url/events?limit=100&pagination_key=S9rgMMUb4z3X5t5pr_tSgoSZlmyF0O8X7kCV2m981-iY1LmRTjraa1rTk3L-hQExnDWCi0RA-zAIjaVSTNO2AN2eqQWgzT0RjbieMxRfSdkM-HmOhdOgdQvYfPG3vqU1DJKh4Q` :type pagination_key: str - :param visitor_id: Unique [visitor identifier](https://docs.fingerprint.com/reference/js-agent-v4-get-function#visitor_id) issued by Fingerprint Identification and all active Smart Signals. Filter events by matching Visitor ID (`identification.visitor_id` property). + :param visitor_id: Unique [visitor identifier](https://docs.fingerprint.com/reference/js-agent-get-function#visitor_id) issued by Fingerprint Identification and all active Smart Signals. Filter events by matching Visitor ID (`identification.visitor_id` property). :type visitor_id: str :param high_recall_id: The High Recall ID is a supplementary browser identifier designed for use cases that require wider coverage over precision. Compared to the standard visitor ID, the High Recall ID strives to match incoming browsers more generously (rather than precisely) with existing browsers and thus identifies fewer browsers as new. The High Recall ID is best suited for use cases that are sensitive to browsers being identified as new and where mismatched browsers are not detrimental. Filter events by matching High Recall ID (`supplementary_id_high_recall.visitor_id` property). :type high_recall_id: str @@ -1444,7 +1677,7 @@ def search_events_with_http_info( :type ip_address: str :param asn: Filter events by the ASN associated with the event's IP address. This corresponds to the `ip_info.(v4|v6).asn` property in the response. :type asn: str - :param linked_id: Filter events by your custom identifier. You can use [linked Ids](https://docs.fingerprint.com/reference/js-agent-v4-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. + :param linked_id: Filter events by your custom identifier. You can use [linked Ids](https://docs.fingerprint.com/reference/js-agent-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. :type linked_id: str :param url: Filter events by the URL (`url` property) associated with the event. :type url: str @@ -1518,10 +1751,10 @@ def search_events_with_http_info( :type incremental_identification_status: SearchEventsIncrementalIdentificationStatus :param simulator: Filter events by iOS Simulator Detection result. > Note: When using this parameter, only events with the `simulator` property set to `true` or `false` are returned. Events without a `simulator` Smart Signal result are left out of the response. :type simulator: bool - :param source: Selects the source of events to search. When omitted, only traditional identification events generated from devices are returned (the default behavior). When set to `edge`, only Automation Intelligence (Edge) events are returned. To retrieve all events regardless of source, you must make two requests. One with the `source` parameter set to `edge`, and another with the `source` parameter omitted. > Note: The Automation Intelligence API is in public preview testing phase. If you encounter any issues, please [contact](https://fingerprint.com/support/) our support team. - :type source: List[SearchEventsSource] :param active_call: Filter events by Active Call Detection result on mobile devices. > Note: When using this parameter, only events with the `active_call` property set to `true` or `false` are returned. Events without an `active_call` Smart Signal result are left out of the response. :type active_call: bool + :param source: Selects the source of events to search. When omitted, only traditional identification events generated from devices are returned (the default behavior). When set to `edge`, only Automation Intelligence (Edge) events are returned. To retrieve all events regardless of source, you must make two requests. One with the `source` parameter set to `edge`, and another with the `source` parameter omitted. > Note: The Automation Intelligence API is in public preview testing phase. If you encounter any issues, please [contact](https://fingerprint.com/support/) our support team. + :type source: List[SearchEventsSource] :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -1591,8 +1824,8 @@ def search_events_with_http_info( tor_node=tor_node, incremental_identification_status=incremental_identification_status, simulator=simulator, - source=source, active_call=active_call, + source=source, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -1633,7 +1866,7 @@ def search_events_without_preload_content( visitor_id: Annotated[ Optional[StrictStr], Field( - description='Unique [visitor identifier](https://docs.fingerprint.com/reference/js-agent-v4-get-function#visitor_id) issued by Fingerprint Identification and all active Smart Signals. Filter events by matching Visitor ID (`identification.visitor_id` property). ' + description='Unique [visitor identifier](https://docs.fingerprint.com/reference/js-agent-get-function#visitor_id) issued by Fingerprint Identification and all active Smart Signals. Filter events by matching Visitor ID (`identification.visitor_id` property). ' ), ] = None, high_recall_id: Annotated[ @@ -1699,7 +1932,7 @@ def search_events_without_preload_content( linked_id: Annotated[ Optional[StrictStr], Field( - description='Filter events by your custom identifier. You can use [linked Ids](https://docs.fingerprint.com/reference/js-agent-v4-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. ' + description='Filter events by your custom identifier. You can use [linked Ids](https://docs.fingerprint.com/reference/js-agent-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. ' ), ] = None, url: Annotated[ @@ -1916,18 +2149,18 @@ def search_events_without_preload_content( description='Filter events by iOS Simulator Detection result. > Note: When using this parameter, only events with the `simulator` property set to `true` or `false` are returned. Events without a `simulator` Smart Signal result are left out of the response. ' ), ] = None, - source: Annotated[ - Optional[Annotated[list[SearchEventsSource], Field(max_length=1)]], - Field( - description='Selects the source of events to search. When omitted, only traditional identification events generated from devices are returned (the default behavior). When set to `edge`, only Automation Intelligence (Edge) events are returned. To retrieve all events regardless of source, you must make two requests. One with the `source` parameter set to `edge`, and another with the `source` parameter omitted. > Note: The Automation Intelligence API is in public preview testing phase. If you encounter any issues, please [contact](https://fingerprint.com/support/) our support team. ' - ), - ] = None, active_call: Annotated[ Optional[StrictBool], Field( description='Filter events by Active Call Detection result on mobile devices. > Note: When using this parameter, only events with the `active_call` property set to `true` or `false` are returned. Events without an `active_call` Smart Signal result are left out of the response. ' ), ] = None, + source: Annotated[ + Optional[Annotated[list[SearchEventsSource], Field(max_length=1)]], + Field( + description='Selects the source of events to search. When omitted, only traditional identification events generated from devices are returned (the default behavior). When set to `edge`, only Automation Intelligence (Edge) events are returned. To retrieve all events regardless of source, you must make two requests. One with the `source` parameter set to `edge`, and another with the `source` parameter omitted. > Note: The Automation Intelligence API is in public preview testing phase. If you encounter any issues, please [contact](https://fingerprint.com/support/) our support team. ' + ), + ] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -1945,7 +2178,7 @@ def search_events_without_preload_content( :type limit: int :param pagination_key: Use `pagination_key` to get the next page of results. When more results are available (e.g., you requested up to 100 results for your query using `limit`, but there are more than 100 events total matching your request), the `pagination_key` field is added to the response. The pagination key is an arbitrary string that should not be interpreted in any way and should be passed as-is. In the following request, use that value in the `pagination_key` parameter to get the next page of results: 1. First request, returning most recent 100 events: `GET api-base-url/events?limit=100` 2. Use `response.pagination_key` to get the next page of results: `GET api-base-url/events?limit=100&pagination_key=S9rgMMUb4z3X5t5pr_tSgoSZlmyF0O8X7kCV2m981-iY1LmRTjraa1rTk3L-hQExnDWCi0RA-zAIjaVSTNO2AN2eqQWgzT0RjbieMxRfSdkM-HmOhdOgdQvYfPG3vqU1DJKh4Q` :type pagination_key: str - :param visitor_id: Unique [visitor identifier](https://docs.fingerprint.com/reference/js-agent-v4-get-function#visitor_id) issued by Fingerprint Identification and all active Smart Signals. Filter events by matching Visitor ID (`identification.visitor_id` property). + :param visitor_id: Unique [visitor identifier](https://docs.fingerprint.com/reference/js-agent-get-function#visitor_id) issued by Fingerprint Identification and all active Smart Signals. Filter events by matching Visitor ID (`identification.visitor_id` property). :type visitor_id: str :param high_recall_id: The High Recall ID is a supplementary browser identifier designed for use cases that require wider coverage over precision. Compared to the standard visitor ID, the High Recall ID strives to match incoming browsers more generously (rather than precisely) with existing browsers and thus identifies fewer browsers as new. The High Recall ID is best suited for use cases that are sensitive to browsers being identified as new and where mismatched browsers are not detrimental. Filter events by matching High Recall ID (`supplementary_id_high_recall.visitor_id` property). :type high_recall_id: str @@ -1967,7 +2200,7 @@ def search_events_without_preload_content( :type ip_address: str :param asn: Filter events by the ASN associated with the event's IP address. This corresponds to the `ip_info.(v4|v6).asn` property in the response. :type asn: str - :param linked_id: Filter events by your custom identifier. You can use [linked Ids](https://docs.fingerprint.com/reference/js-agent-v4-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. + :param linked_id: Filter events by your custom identifier. You can use [linked Ids](https://docs.fingerprint.com/reference/js-agent-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. :type linked_id: str :param url: Filter events by the URL (`url` property) associated with the event. :type url: str @@ -2041,10 +2274,10 @@ def search_events_without_preload_content( :type incremental_identification_status: SearchEventsIncrementalIdentificationStatus :param simulator: Filter events by iOS Simulator Detection result. > Note: When using this parameter, only events with the `simulator` property set to `true` or `false` are returned. Events without a `simulator` Smart Signal result are left out of the response. :type simulator: bool - :param source: Selects the source of events to search. When omitted, only traditional identification events generated from devices are returned (the default behavior). When set to `edge`, only Automation Intelligence (Edge) events are returned. To retrieve all events regardless of source, you must make two requests. One with the `source` parameter set to `edge`, and another with the `source` parameter omitted. > Note: The Automation Intelligence API is in public preview testing phase. If you encounter any issues, please [contact](https://fingerprint.com/support/) our support team. - :type source: List[SearchEventsSource] :param active_call: Filter events by Active Call Detection result on mobile devices. > Note: When using this parameter, only events with the `active_call` property set to `true` or `false` are returned. Events without an `active_call` Smart Signal result are left out of the response. :type active_call: bool + :param source: Selects the source of events to search. When omitted, only traditional identification events generated from devices are returned (the default behavior). When set to `edge`, only Automation Intelligence (Edge) events are returned. To retrieve all events regardless of source, you must make two requests. One with the `source` parameter set to `edge`, and another with the `source` parameter omitted. > Note: The Automation Intelligence API is in public preview testing phase. If you encounter any issues, please [contact](https://fingerprint.com/support/) our support team. + :type source: List[SearchEventsSource] :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -2114,8 +2347,8 @@ def search_events_without_preload_content( tor_node=tor_node, incremental_identification_status=incremental_identification_status, simulator=simulator, - source=source, active_call=active_call, + source=source, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -2186,8 +2419,8 @@ def _search_events_serialize( tor_node: Optional[bool], incremental_identification_status: Optional[SearchEventsIncrementalIdentificationStatus], simulator: Optional[bool], - source: Optional[list[SearchEventsSource]], active_call: Optional[bool], + source: Optional[list[SearchEventsSource]], _request_auth: Optional[dict[StrictStr, Any]], _content_type: Optional[StrictStr], _headers: Optional[dict[StrictStr, Any]], @@ -2425,14 +2658,14 @@ def _search_events_serialize( if simulator is not None: _query_params.append(('simulator', simulator)) - # process the query parameters - if source is not None: - _query_params.append(('source', source)) - # process the query parameters if active_call is not None: _query_params.append(('active_call', active_call)) + # process the query parameters + if source is not None: + _query_params.append(('source', source)) + # set the HTTP header `Accept` if 'Accept' not in _header_params: _header_params['Accept'] = self.api_client.select_header_accept(['application/json']) @@ -2460,7 +2693,7 @@ def update_event( event_id: Annotated[ StrictStr, Field( - description='The unique event [identifier](https://docs.fingerprint.com/reference/js-agent-v4-get-function#event_id).' + description='The unique event [identifier](https://docs.fingerprint.com/reference/js-agent-get-function#event_id).' ), ], event_update: EventUpdate, @@ -2477,7 +2710,7 @@ def update_event( Change information in existing events specified by `event_id` or *flag suspicious events*. When an event is created, it can be assigned `linked_id` and `tags` submitted through the JS agent parameters. This information might not have been available on the client initially, so the Server API permits updating these attributes after the fact. **Warning** It's not possible to update events older than one month. **Warning** Trying to update an event immediately after creation may temporarily result in an error (HTTP 409 Conflict. The event is not mutable yet.) as the event is fully propagated across our systems. In such a case, simply retry the request. - :param event_id: The unique event [identifier](https://docs.fingerprint.com/reference/js-agent-v4-get-function#event_id). (required) + :param event_id: The unique event [identifier](https://docs.fingerprint.com/reference/js-agent-get-function#event_id). (required) :type event_id: str :param event_update: (required) :type event_update: EventUpdate @@ -2528,7 +2761,7 @@ def update_event_with_http_info( event_id: Annotated[ StrictStr, Field( - description='The unique event [identifier](https://docs.fingerprint.com/reference/js-agent-v4-get-function#event_id).' + description='The unique event [identifier](https://docs.fingerprint.com/reference/js-agent-get-function#event_id).' ), ], event_update: EventUpdate, @@ -2545,7 +2778,7 @@ def update_event_with_http_info( Change information in existing events specified by `event_id` or *flag suspicious events*. When an event is created, it can be assigned `linked_id` and `tags` submitted through the JS agent parameters. This information might not have been available on the client initially, so the Server API permits updating these attributes after the fact. **Warning** It's not possible to update events older than one month. **Warning** Trying to update an event immediately after creation may temporarily result in an error (HTTP 409 Conflict. The event is not mutable yet.) as the event is fully propagated across our systems. In such a case, simply retry the request. - :param event_id: The unique event [identifier](https://docs.fingerprint.com/reference/js-agent-v4-get-function#event_id). (required) + :param event_id: The unique event [identifier](https://docs.fingerprint.com/reference/js-agent-get-function#event_id). (required) :type event_id: str :param event_update: (required) :type event_update: EventUpdate @@ -2596,7 +2829,7 @@ def update_event_without_preload_content( event_id: Annotated[ StrictStr, Field( - description='The unique event [identifier](https://docs.fingerprint.com/reference/js-agent-v4-get-function#event_id).' + description='The unique event [identifier](https://docs.fingerprint.com/reference/js-agent-get-function#event_id).' ), ], event_update: EventUpdate, @@ -2613,7 +2846,7 @@ def update_event_without_preload_content( Change information in existing events specified by `event_id` or *flag suspicious events*. When an event is created, it can be assigned `linked_id` and `tags` submitted through the JS agent parameters. This information might not have been available on the client initially, so the Server API permits updating these attributes after the fact. **Warning** It's not possible to update events older than one month. **Warning** Trying to update an event immediately after creation may temporarily result in an error (HTTP 409 Conflict. The event is not mutable yet.) as the event is fully propagated across our systems. In such a case, simply retry the request. - :param event_id: The unique event [identifier](https://docs.fingerprint.com/reference/js-agent-v4-get-function#event_id). (required) + :param event_id: The unique event [identifier](https://docs.fingerprint.com/reference/js-agent-get-function#event_id). (required) :type event_id: str :param event_update: (required) :type event_update: EventUpdate diff --git a/fingerprint_server_sdk/models/__init__.py b/fingerprint_server_sdk/models/__init__.py index eba59cff..4edf2522 100644 --- a/fingerprint_server_sdk/models/__init__.py +++ b/fingerprint_server_sdk/models/__init__.py @@ -20,11 +20,14 @@ from fingerprint_server_sdk.models.bot_result import BotResult from fingerprint_server_sdk.models.browser_details import BrowserDetails from fingerprint_server_sdk.models.canvas import Canvas +from fingerprint_server_sdk.models.edge_request import EdgeRequest +from fingerprint_server_sdk.models.edge_request_headers_inner import EdgeRequestHeadersInner from fingerprint_server_sdk.models.emoji import Emoji from fingerprint_server_sdk.models.error import Error from fingerprint_server_sdk.models.error_code import ErrorCode from fingerprint_server_sdk.models.error_response import ErrorResponse from fingerprint_server_sdk.models.event import Event +from fingerprint_server_sdk.models.event_edge import EventEdge from fingerprint_server_sdk.models.event_rule_action import EventRuleAction from fingerprint_server_sdk.models.event_rule_action_allow import EventRuleActionAllow from fingerprint_server_sdk.models.event_rule_action_block import EventRuleActionBlock diff --git a/fingerprint_server_sdk/models/edge_request.py b/fingerprint_server_sdk/models/edge_request.py new file mode 100644 index 00000000..4f489e1d --- /dev/null +++ b/fingerprint_server_sdk/models/edge_request.py @@ -0,0 +1,139 @@ +""" +Server API +Fingerprint Server API allows you to get, search, and update 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. +The API also supports collection of Automation Intelligence for requests to your server in edge, pre-origin, or middleware contexts. + +The version of the OpenAPI document: 4 +Contact: support@fingerprint.com +Generated by OpenAPI Generator (https://openapi-generator.tech) + +Do not edit the class manually. +""" # noqa: E501 + +from __future__ import annotations + +import json +import pprint +import re # noqa: F401 +from typing import Annotated, Any, ClassVar, Optional + +from pydantic import BaseModel, ConfigDict, Field, StrictStr, model_validator +from typing_extensions import Self + +from fingerprint_server_sdk.models.edge_request_headers_inner import EdgeRequestHeadersInner + + +class EdgeRequest(BaseModel): + """ + HTTP request metadata (including the HTTP method, headers and IP address) sent by you (your server) to the Fingerprint API for IP and bot analysis. To improve accuracy, retain as much of the original semantics of the HTTP request as possible. For example, preserve the order of the request headers and their capitalization. At least one of `ipv4_address` or `ipv6_address` must be provided; a request with neither is rejected with a `400` error. If both IPv4 and IPv6 are provided, IP intelligence will be provided for each address. If an IPv4-mapped IPv6 address is provided in the `ipv6_address` request property, the IP intelligence will be provided in the `ipv4_address` property of the response. + """ + + headers: Annotated[list[EdgeRequestHeadersInner], Field(min_length=1)] = Field( + description='Ordered header entries from the request made to your server. Each entry represents one header line. If one header name appears as multiple lines, send each as a separate item in the array. Headers that contain authentication or session data must still be included, but with their value set to an empty string. This includes headers like `Authorization` and `Cookie`, but may contain more depending on your specific project, for instance `Proxy-Authenticate` or `X-Api-Key`. Omitting the headers entirely changes the shape of the request and can affect detection. Never forward the real secret values. Whenever possible, we recommend preserving header order and capitalization to provide the best accuracy, however it’s not a strict requirement if your runtime does not maintain http header order or canonicalizes header names. ' + ) + method: StrictStr = Field( + description='The original HTTP method of the request. If supported in your runtime, preserve the original casing.' + ) + url: StrictStr = Field( + description='Absolute URL of the request, without a \\#fragment suffix. Only HTTP and HTTPS schemes are supported.' + ) + ipv4_address: Optional[StrictStr] = Field( + default=None, description='Client IPv4 address observed by your server.' + ) + ipv6_address: Optional[StrictStr] = Field( + default=None, description='Client IPv6 address observed by your server.' + ) + linked_id: Optional[StrictStr] = Field( + default=None, description='A customer-provided id that was sent with the request.' + ) + tags: Optional[dict[str, Any]] = Field( + default=None, + description='A customer-provided value or an object that was sent with the identification request or updated later.', + ) + __properties: ClassVar[list[str]] = [ + 'headers', + 'method', + 'url', + 'ipv4_address', + 'ipv6_address', + 'linked_id', + 'tags', + ] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + @model_validator(mode='after') + def check_at_least_one_ip_address(self) -> Self: + """Validates that at least one of `ipv4_address` or `ipv6_address` is set""" + if self.ipv4_address is None and self.ipv6_address is None: + raise ValueError('At least one of `ipv4_address` or `ipv6_address` must be provided') + return self + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of EdgeRequest from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in headers (list) + _items = [] + if self.headers: + for _item_headers in self.headers: + if _item_headers: + _items.append(_item_headers.to_dict()) + _dict['headers'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[dict[str, Any]]) -> Optional[Self]: + """Create an instance of EdgeRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate( + { + 'headers': [EdgeRequestHeadersInner.from_dict(_item) for _item in obj['headers']] + if obj.get('headers') is not None + else None, + 'method': obj.get('method'), + 'url': obj.get('url'), + 'ipv4_address': obj.get('ipv4_address'), + 'ipv6_address': obj.get('ipv6_address'), + 'linked_id': obj.get('linked_id'), + 'tags': obj.get('tags'), + } + ) + return _obj diff --git a/fingerprint_server_sdk/models/edge_request_headers_inner.py b/fingerprint_server_sdk/models/edge_request_headers_inner.py new file mode 100644 index 00000000..85d3debf --- /dev/null +++ b/fingerprint_server_sdk/models/edge_request_headers_inner.py @@ -0,0 +1,87 @@ +""" +Server API +Fingerprint Server API allows you to get, search, and update 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. +The API also supports collection of Automation Intelligence for requests to your server in edge, pre-origin, or middleware contexts. + +The version of the OpenAPI document: 4 +Contact: support@fingerprint.com +Generated by OpenAPI Generator (https://openapi-generator.tech) + +Do not edit the class manually. +""" # noqa: E501 + +from __future__ import annotations + +import json +import pprint +import re # noqa: F401 +from typing import Any, ClassVar, Optional + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing_extensions import Self + + +class EdgeRequestHeadersInner(BaseModel): + """ + EdgeRequestHeadersInner + """ + + name: StrictStr = Field( + description='Header name as forwarded by your server. Headers must be valid according to RFC 7230 and will be canonicalized according to RFC 9112.' + ) + value: StrictStr = Field( + description='Value of a single forwarded header entry. Be careful to preserve the original encoding and escaping. For example, do not double escape quotes.' + ) + __properties: ClassVar[list[str]] = ['name', 'value'] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of EdgeRequestHeadersInner from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[dict[str, Any]]) -> Optional[Self]: + """Create an instance of EdgeRequestHeadersInner from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({'name': obj.get('name'), 'value': obj.get('value')}) + return _obj diff --git a/fingerprint_server_sdk/models/event.py b/fingerprint_server_sdk/models/event.py index 9badf776..e9848126 100644 --- a/fingerprint_server_sdk/models/event.py +++ b/fingerprint_server_sdk/models/event.py @@ -49,7 +49,7 @@ class Event(BaseModel): """ - Contains results from Fingerprint Identification and all active Smart Signals. Some Smart Signals are only supported for certain device types, these fields will be omitted for events not generated from the supported devices. Consult the [Smart Signals reference](https://docs.fingerprint.com/docs/smart-signals-reference) for more details. + An identification event (`source: device`) or an Automation Intelligence event (`source: edge`). Use `source` to tell them apart. Device events include Identification and device-derived Smart Signals. Edge events do not. Consult the [Smart Signals reference](https://docs.fingerprint.com/docs/smart-signals-reference) for more details. """ event_id: StrictStr = Field( @@ -58,17 +58,38 @@ class Event(BaseModel): timestamp: StrictInt = Field( description='Timestamp of the event with millisecond precision in Unix time.' ) - source: Optional[EventSource] = None - incremental_identification_status: Optional[IncrementalIdentificationStatus] = None linked_id: Optional[StrictStr] = Field( default=None, description='A customer-provided id that was sent with the request.' ) + tags: Optional[dict[str, Any]] = Field( + default=None, + description='A customer-provided value or an object that was sent with the identification request or updated later.', + ) + url: Optional[StrictStr] = Field( + default=None, description='Page URL from which the request was sent.' + ) + bot_info: Optional[BotInfo] = None + ip_info: Optional[IPInfo] = None + proxy: Optional[StrictBool] = Field( + default=None, + description='IP address was used by a public proxy provider or belonged to a known recent residential proxy ', + ) + proxy_confidence: Optional[ProxyConfidence] = None + proxy_details: Optional[ProxyDetails] = None + vpn: Optional[StrictBool] = Field( + default=None, + description='VPN or other anonymizing service has been used when sending the request. ', + ) + vpn_confidence: Optional[VpnConfidence] = None + vpn_methods: Optional[VpnMethods] = None + source: Optional[EventSource] = None + incremental_identification_status: Optional[IncrementalIdentificationStatus] = None environment_id: Optional[StrictStr] = Field( default=None, description='Environment Id of the event.' ) suspect: Optional[StrictBool] = Field( default=None, - description='Field is `true` if you have previously set the `suspect` flag for this event using the [Server API Update event endpoint](https://docs.fingerprint.com/reference/server-api-v4-update-event).', + description='Field is `true` if you have previously set the `suspect` flag for this event using the [Server API Update event endpoint](https://docs.fingerprint.com/reference/server-api-update-event).', ) sdk: Optional[SDK] = None replayed: Optional[StrictBool] = Field( @@ -77,13 +98,6 @@ class Event(BaseModel): ) identification: Optional[Identification] = None supplementary_id_high_recall: Optional[SupplementaryIDHighRecall] = None - tags: Optional[dict[str, Any]] = Field( - default=None, - description='A customer-provided value or an object that was sent with the identification request or updated later.', - ) - url: Optional[StrictStr] = Field( - default=None, description='Page URL from which the request was sent.' - ) bundle_id: Optional[StrictStr] = Field( default=None, description='Bundle Id of the iOS application integrated with the Fingerprint SDK for the event. ', @@ -122,7 +136,6 @@ class Event(BaseModel): bot_type: Optional[StrictStr] = Field( default=None, description='Additional classification of the bot type if detected. ' ) - bot_info: Optional[BotInfo] = None cloned_app: Optional[StrictBool] = Field( default=None, description='Android specific cloned application detection. There are 2 values: * `true` - Presence of app cloners work detected (e.g. fully cloned application found or launch of it inside of a not main working profile detected). * `false` - No signs of cloned application detected or the client is not Android. ', @@ -144,13 +157,6 @@ class Event(BaseModel): description='[Frida](https://frida.re/docs/) detection for Android and iOS devices. There are 2 values: * `true` - Frida detected * `false` - No signs of Frida or the client is not a mobile device. ', ) ip_blocklist: Optional[IPBlockList] = None - ip_info: Optional[IPInfo] = None - proxy: Optional[StrictBool] = Field( - default=None, - description='IP address was used by a public proxy provider or belonged to a known recent residential proxy ', - ) - proxy_confidence: Optional[ProxyConfidence] = None - proxy_details: Optional[ProxyDetails] = None proxy_ml_score: Optional[ Union[ Annotated[float, Field(le=1, strict=True, ge=0)], @@ -222,11 +228,6 @@ class Event(BaseModel): default=None, description='Machine learning–based virtual machine score, represented as a floating-point value between 0 and 1 (inclusive), with up to three decimal places of precision. A higher score means a higher confidence in the positive `virtual_machine` detection result. This Smart Signal is currently in beta and only available to select customers. If you are interested, please [contact our support team](https://fingerprint.com/support/). ', ) - vpn: Optional[StrictBool] = Field( - default=None, - description='VPN or other anonymizing service has been used when sending the request. ', - ) - vpn_confidence: Optional[VpnConfidence] = None vpn_ml_score: Optional[ Union[ Annotated[float, Field(le=1, strict=True, ge=0)], @@ -243,7 +244,6 @@ class Event(BaseModel): default=None, description='Country of the request (Android SDK version >= 2.4.0, iOS SDK version >= 2.9.0, JS agent >= 3.12.9 / 4.0.2), ISO 3166 format or unknown. ', ) - vpn_methods: Optional[VpnMethods] = None high_activity_device: Optional[StrictBool] = Field( default=None, description='Flag indicating if the request came from a high-activity visitor.', @@ -261,17 +261,25 @@ class Event(BaseModel): __properties: ClassVar[list[str]] = [ 'event_id', 'timestamp', + 'linked_id', + 'tags', + 'url', + 'bot_info', + 'ip_info', + 'proxy', + 'proxy_confidence', + 'proxy_details', + 'vpn', + 'vpn_confidence', + 'vpn_methods', 'source', 'incremental_identification_status', - 'linked_id', 'environment_id', 'suspect', 'sdk', 'replayed', 'identification', 'supplementary_id_high_recall', - 'tags', - 'url', 'bundle_id', 'package_name', 'ip_address', @@ -285,17 +293,12 @@ class Event(BaseModel): 'active_call', 'bot', 'bot_type', - 'bot_info', 'cloned_app', 'developer_tools', 'emulator', 'factory_reset_timestamp', 'frida', 'ip_blocklist', - 'ip_info', - 'proxy', - 'proxy_confidence', - 'proxy_details', 'proxy_ml_score', 'incognito', 'jailbroken', @@ -313,12 +316,9 @@ class Event(BaseModel): 'velocity', 'virtual_machine', 'virtual_machine_ml_score', - 'vpn', - 'vpn_confidence', 'vpn_ml_score', 'vpn_origin_timezone', 'vpn_origin_country', - 'vpn_methods', 'high_activity_device', 'rare_device', 'rare_device_percentile_bucket', @@ -363,6 +363,18 @@ def to_dict(self) -> dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) + # override the default output from pydantic by calling `to_dict()` of bot_info + if self.bot_info: + _dict['bot_info'] = self.bot_info.to_dict() + # override the default output from pydantic by calling `to_dict()` of ip_info + if self.ip_info: + _dict['ip_info'] = self.ip_info.to_dict() + # override the default output from pydantic by calling `to_dict()` of proxy_details + if self.proxy_details: + _dict['proxy_details'] = self.proxy_details.to_dict() + # override the default output from pydantic by calling `to_dict()` of vpn_methods + if self.vpn_methods: + _dict['vpn_methods'] = self.vpn_methods.to_dict() # override the default output from pydantic by calling `to_dict()` of sdk if self.sdk: _dict['sdk'] = self.sdk.to_dict() @@ -378,18 +390,9 @@ def to_dict(self) -> dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of proximity if self.proximity: _dict['proximity'] = self.proximity.to_dict() - # override the default output from pydantic by calling `to_dict()` of bot_info - if self.bot_info: - _dict['bot_info'] = self.bot_info.to_dict() # override the default output from pydantic by calling `to_dict()` of ip_blocklist if self.ip_blocklist: _dict['ip_blocklist'] = self.ip_blocklist.to_dict() - # override the default output from pydantic by calling `to_dict()` of ip_info - if self.ip_info: - _dict['ip_info'] = self.ip_info.to_dict() - # override the default output from pydantic by calling `to_dict()` of proxy_details - if self.proxy_details: - _dict['proxy_details'] = self.proxy_details.to_dict() # override the default output from pydantic by calling `to_dict()` of rule_action if self.rule_action: _dict['rule_action'] = self.rule_action.to_dict() @@ -399,9 +402,6 @@ def to_dict(self) -> dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of velocity if self.velocity: _dict['velocity'] = self.velocity.to_dict() - # override the default output from pydantic by calling `to_dict()` of vpn_methods - if self.vpn_methods: - _dict['vpn_methods'] = self.vpn_methods.to_dict() # override the default output from pydantic by calling `to_dict()` of raw_device_attributes if self.raw_device_attributes: _dict['raw_device_attributes'] = self.raw_device_attributes.to_dict() @@ -427,9 +427,27 @@ def from_dict(cls, obj: Optional[dict[str, Any]]) -> Optional[Self]: { 'event_id': obj.get('event_id'), 'timestamp': obj.get('timestamp'), + 'linked_id': obj.get('linked_id'), + 'tags': obj.get('tags'), + 'url': obj.get('url'), + 'bot_info': BotInfo.from_dict(obj['bot_info']) + if obj.get('bot_info') is not None + else None, + 'ip_info': IPInfo.from_dict(obj['ip_info']) + if obj.get('ip_info') is not None + else None, + 'proxy': obj.get('proxy'), + 'proxy_confidence': obj.get('proxy_confidence'), + 'proxy_details': ProxyDetails.from_dict(obj['proxy_details']) + if obj.get('proxy_details') is not None + else None, + 'vpn': obj.get('vpn'), + 'vpn_confidence': obj.get('vpn_confidence'), + 'vpn_methods': VpnMethods.from_dict(obj['vpn_methods']) + if obj.get('vpn_methods') is not None + else None, 'source': obj.get('source'), 'incremental_identification_status': obj.get('incremental_identification_status'), - 'linked_id': obj.get('linked_id'), 'environment_id': obj.get('environment_id'), 'suspect': obj.get('suspect'), 'sdk': SDK.from_dict(obj['sdk']) if obj.get('sdk') is not None else None, @@ -442,8 +460,6 @@ def from_dict(cls, obj: Optional[dict[str, Any]]) -> Optional[Self]: ) if obj.get('supplementary_id_high_recall') is not None else None, - 'tags': obj.get('tags'), - 'url': obj.get('url'), 'bundle_id': obj.get('bundle_id'), 'package_name': obj.get('package_name'), 'ip_address': obj.get('ip_address'), @@ -461,9 +477,6 @@ def from_dict(cls, obj: Optional[dict[str, Any]]) -> Optional[Self]: 'active_call': obj.get('active_call'), 'bot': obj.get('bot'), 'bot_type': obj.get('bot_type'), - 'bot_info': BotInfo.from_dict(obj['bot_info']) - if obj.get('bot_info') is not None - else None, 'cloned_app': obj.get('cloned_app'), 'developer_tools': obj.get('developer_tools'), 'emulator': obj.get('emulator'), @@ -472,14 +485,6 @@ def from_dict(cls, obj: Optional[dict[str, Any]]) -> Optional[Self]: 'ip_blocklist': IPBlockList.from_dict(obj['ip_blocklist']) if obj.get('ip_blocklist') is not None else None, - 'ip_info': IPInfo.from_dict(obj['ip_info']) - if obj.get('ip_info') is not None - else None, - 'proxy': obj.get('proxy'), - 'proxy_confidence': obj.get('proxy_confidence'), - 'proxy_details': ProxyDetails.from_dict(obj['proxy_details']) - if obj.get('proxy_details') is not None - else None, 'proxy_ml_score': obj.get('proxy_ml_score'), 'incognito': obj.get('incognito'), 'jailbroken': obj.get('jailbroken'), @@ -503,14 +508,9 @@ def from_dict(cls, obj: Optional[dict[str, Any]]) -> Optional[Self]: else None, 'virtual_machine': obj.get('virtual_machine'), 'virtual_machine_ml_score': obj.get('virtual_machine_ml_score'), - 'vpn': obj.get('vpn'), - 'vpn_confidence': obj.get('vpn_confidence'), 'vpn_ml_score': obj.get('vpn_ml_score'), 'vpn_origin_timezone': obj.get('vpn_origin_timezone'), 'vpn_origin_country': obj.get('vpn_origin_country'), - 'vpn_methods': VpnMethods.from_dict(obj['vpn_methods']) - if obj.get('vpn_methods') is not None - else None, 'high_activity_device': obj.get('high_activity_device'), 'rare_device': obj.get('rare_device'), 'rare_device_percentile_bucket': obj.get('rare_device_percentile_bucket'), diff --git a/fingerprint_server_sdk/models/event_edge.py b/fingerprint_server_sdk/models/event_edge.py new file mode 100644 index 00000000..5d7b4d42 --- /dev/null +++ b/fingerprint_server_sdk/models/event_edge.py @@ -0,0 +1,172 @@ +""" +Server API +Fingerprint Server API allows you to get, search, and update 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. +The API also supports collection of Automation Intelligence for requests to your server in edge, pre-origin, or middleware contexts. + +The version of the OpenAPI document: 4 +Contact: support@fingerprint.com +Generated by OpenAPI Generator (https://openapi-generator.tech) + +Do not edit the class manually. +""" # noqa: E501 + +from __future__ import annotations + +import json +import pprint +import re # noqa: F401 +from typing import Any, ClassVar, Optional + +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr +from typing_extensions import Self + +from fingerprint_server_sdk.models.bot_info import BotInfo +from fingerprint_server_sdk.models.event_source import EventSource +from fingerprint_server_sdk.models.ip_info import IPInfo +from fingerprint_server_sdk.models.proxy_confidence import ProxyConfidence +from fingerprint_server_sdk.models.proxy_details import ProxyDetails +from fingerprint_server_sdk.models.vpn_confidence import VpnConfidence +from fingerprint_server_sdk.models.vpn_methods import VpnMethods + + +class EventEdge(BaseModel): + """ + IP and bot analysis for an event generated by the Automation Intelligence API (`/edge` endpoint). No client-side collection agent is involved, so Identification (`visitor_id`) and device-telemetry-derived Smart Signals are not available. + """ + + event_id: StrictStr = Field( + description="Unique identifier of the user's request. The first portion of the event_id is a unix epoch milliseconds timestamp. " + ) + timestamp: StrictInt = Field( + description='Timestamp of the event with millisecond precision in Unix time.' + ) + linked_id: Optional[StrictStr] = Field( + default=None, description='A customer-provided id that was sent with the request.' + ) + tags: Optional[dict[str, Any]] = Field( + default=None, + description='A customer-provided value or an object that was sent with the identification request or updated later.', + ) + url: Optional[StrictStr] = Field( + default=None, description='Page URL from which the request was sent.' + ) + bot_info: Optional[BotInfo] = None + ip_info: IPInfo + proxy: Optional[StrictBool] = Field( + default=None, + description='IP address was used by a public proxy provider or belonged to a known recent residential proxy ', + ) + proxy_confidence: Optional[ProxyConfidence] = None + proxy_details: Optional[ProxyDetails] = None + vpn: Optional[StrictBool] = Field( + default=None, + description='VPN or other anonymizing service has been used when sending the request. ', + ) + vpn_confidence: Optional[VpnConfidence] = None + vpn_methods: Optional[VpnMethods] = None + source: EventSource + __properties: ClassVar[list[str]] = [ + 'event_id', + 'timestamp', + 'linked_id', + 'tags', + 'url', + 'bot_info', + 'ip_info', + 'proxy', + 'proxy_confidence', + 'proxy_details', + 'vpn', + 'vpn_confidence', + 'vpn_methods', + 'source', + ] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of EventEdge from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of bot_info + if self.bot_info: + _dict['bot_info'] = self.bot_info.to_dict() + # override the default output from pydantic by calling `to_dict()` of ip_info + if self.ip_info: + _dict['ip_info'] = self.ip_info.to_dict() + # override the default output from pydantic by calling `to_dict()` of proxy_details + if self.proxy_details: + _dict['proxy_details'] = self.proxy_details.to_dict() + # override the default output from pydantic by calling `to_dict()` of vpn_methods + if self.vpn_methods: + _dict['vpn_methods'] = self.vpn_methods.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[dict[str, Any]]) -> Optional[Self]: + """Create an instance of EventEdge from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate( + { + 'event_id': obj.get('event_id'), + 'timestamp': obj.get('timestamp'), + 'linked_id': obj.get('linked_id'), + 'tags': obj.get('tags'), + 'url': obj.get('url'), + 'bot_info': BotInfo.from_dict(obj['bot_info']) + if obj.get('bot_info') is not None + else None, + 'ip_info': IPInfo.from_dict(obj['ip_info']) + if obj.get('ip_info') is not None + else None, + 'proxy': obj.get('proxy'), + 'proxy_confidence': obj.get('proxy_confidence'), + 'proxy_details': ProxyDetails.from_dict(obj['proxy_details']) + if obj.get('proxy_details') is not None + else None, + 'vpn': obj.get('vpn'), + 'vpn_confidence': obj.get('vpn_confidence'), + 'vpn_methods': VpnMethods.from_dict(obj['vpn_methods']) + if obj.get('vpn_methods') is not None + else None, + 'source': obj.get('source'), + } + ) + return _obj diff --git a/res/fingerprint-server-api.yaml b/res/fingerprint-server-api.yaml index 5e7a37ba..ea612158 100644 --- a/res/fingerprint-server-api.yaml +++ b/res/fingerprint-server-api.yaml @@ -37,6 +37,97 @@ servers: security: - bearerAuth: [] paths: + /edge: + post: + tags: + - Fingerprint + operationId: analyzeRequestForAutomationIntelligence + summary: Collect Automation Intelligence. + description: > + The Automation Intelligence API gives you the tools to determine whether + traffic is legitimate and should be accepted by your application. + + + This feature is currently in a Public Preview testing phase. All + feedback is welcome! If you encounter any issues, please [contact our + support team](https://fingerprint.com/support/). + + + The API detects automation tools like AI Agents, AI Assistants, AI + Browsers, and other bots. Additionally, it provides IP intelligence like + geolocation, residential proxy, VPN and data center detection. + + + Automation Intelligence is derived from HTTP request metadata that + reaches your server. It does not require the use of a JavaScript + client-side agent or mobile SDKs to collect device context. + + + The API is fast, with average response times of less than 30ms, making + it a great fit for edge, pre-origin or middleware contexts. The API is + platform-agnostic and can be used with different CDN providers, cloud + platforms, or any server backend. + + + Because this API doesn’t require the use of a client-side device + collection agent, it doesn’t support device identification via + `visitor_id` and a few Smart Signals derived from deep device telemetry. + + + ### Event Retrieval + + + Events created by the Automation Intelligence API can be fetched via the + [`/v4/events/{event_id}`](https://docs.fingerprint.com/reference/server-api-get-event) + API using the `event_id` present in the API response. + + + Fetch all Automation Intelligence API events via the + [`/v4/events?source=edge`](https://docs.fingerprint.com/reference/server-api-search-events#parameter-source) + API. + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/EdgeRequest' + responses: + '200': + description: OK. + content: + application/json: + schema: + $ref: '#/components/schemas/EventEdge' + '400': + description: Bad request. The request payload is not valid. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + '403': + description: Forbidden. Access to this API is denied. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + '413': + description: Bad request. The request payload is too large. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + '429': + description: Too Many Requests. The request is throttled. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + '500': + description: Workspace error. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' /events/{event_id}: get: tags: @@ -44,12 +135,15 @@ paths: operationId: getEvent summary: Get an event by event ID description: > - Get a detailed analysis of an individual identification event, including - Smart Signals. + Get a detailed analysis of an individual event, including Smart Signals. Use `event_id` as the URL path parameter. This API method is scoped to a request, i.e. all returned information is by `event_id`. + + + Use `source` to tell identification events (`device`) from Automation + Intelligence events (`edge`). parameters: - name: event_id in: path @@ -61,7 +155,7 @@ paths: example: 1708102555327.NLOjmg description: >- The unique - [identifier](https://docs.fingerprint.com/reference/js-agent-v4-get-function#event_id) + [identifier](https://docs.fingerprint.com/reference/js-agent-get-function#event_id) of each identification request (`requestId` can be used in its place). - name: ruleset_id @@ -165,7 +259,7 @@ paths: example: 1708102555327.NLOjmg description: >- The unique event - [identifier](https://docs.fingerprint.com/reference/js-agent-v4-get-function#event_id). + [identifier](https://docs.fingerprint.com/reference/js-agent-get-function#event_id). requestBody: required: true content: @@ -317,7 +411,7 @@ paths: example: Ibk1527CUFmcnjLwIs4A9 description: > Unique [visitor - identifier](https://docs.fingerprint.com/reference/js-agent-v4-get-function#visitor_id) + identifier](https://docs.fingerprint.com/reference/js-agent-get-function#visitor_id) issued by Fingerprint Identification and all active Smart Signals. @@ -492,7 +586,7 @@ paths: You can use [linked - Ids](https://docs.fingerprint.com/reference/js-agent-v4-get-function#linkedid) + Ids](https://docs.fingerprint.com/reference/js-agent-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 @@ -940,6 +1034,18 @@ paths: > Note: When using this parameter, only events with the `simulator` property set to `true` or `false` are returned. Events without a `simulator` Smart Signal result are left out of the response. + - name: active_call + in: query + schema: + type: boolean + description: > + Filter events by Active Call Detection result on mobile devices. + + + > Note: When using this parameter, only events with the + `active_call` property set to `true` or `false` are returned. Events + without an `active_call` Smart Signal result are left out of the + response. - name: source in: query required: false @@ -963,18 +1069,6 @@ paths: > Note: The Automation Intelligence API is in public preview testing phase. If you encounter any issues, please [contact](https://fingerprint.com/support/) our support team. - - name: active_call - in: query - schema: - type: boolean - description: > - Filter events by Active Call Detection result on mobile devices. - - - > Note: When using this parameter, only events with the - `active_call` property set to `true` or `false` are returned. Events - without an `active_call` Smart Signal result are left out of the - response. responses: '200': description: Events matching the filter(s). @@ -1110,7 +1204,7 @@ paths: example: Ibk1527CUFmcnjLwIs4A9 description: >- The [visitor - ID](https://docs.fingerprint.com/reference/js-agent-v4-get-function#visitor_id) + ID](https://docs.fingerprint.com/reference/js-agent-get-function#visitor_id) you want to delete. responses: '200': @@ -1163,6 +1257,138 @@ components: identification request or updated later. additionalProperties: true required: [] + EdgeRequest: + type: object + description: >- + HTTP request metadata (including the HTTP method, headers and IP + address) sent by you (your server) to the Fingerprint API for IP and bot + analysis. To improve accuracy, retain as much of the original semantics + of the HTTP request as possible. For example, preserve the order of the + request headers and their capitalization. + + At least one of `ipv4_address` or `ipv6_address` must be provided; a + request with neither is rejected with a `400` error. If both IPv4 and + IPv6 are provided, IP intelligence will be provided for each address. If + an IPv4-mapped IPv6 address is provided in the `ipv6_address` request + property, the IP intelligence will be provided in the `ipv4_address` + property of the response. + example: + method: GET + url: https://example.com/login + ipv4_address: 34.162.244.71 + headers: + - name: Host + value: example.com + - name: User-Agent + value: Mozilla/5.0 + - name: Authorization + value: '' + required: + - headers + - method + - url + properties: + headers: + type: array + description: > + Ordered header entries from the request made to your server. Each + entry represents one header line. If one header name appears as + multiple lines, send each as a separate item in the array. + + + Headers that contain authentication or session data must still be + included, but with their value set to an empty string. This includes + headers like `Authorization` and `Cookie`, but may contain more + depending on your specific project, for instance + `Proxy-Authenticate` or `X-Api-Key`. Omitting the headers entirely + changes the shape of the request and can affect detection. Never + forward the real secret values. + + + Whenever possible, we recommend preserving header order and + capitalization to provide the best accuracy, however it’s not a + strict requirement if your runtime does not maintain http header + order or canonicalizes header names. + minItems: 1 + items: + type: object + required: + - name + - value + properties: + name: + type: string + examples: + - User-Agent + description: >- + Header name as forwarded by your server. Headers must be valid + according to RFC 7230 and will be canonicalized according to + RFC 9112. + value: + type: string + examples: + - Mozilla/5.0 + description: >- + Value of a single forwarded header entry. Be careful to + preserve the original encoding and escaping. For example, do + not double escape quotes. + examples: + - - name: Host + value: example.com + - name: User-Agent + value: Mozilla/5.0 + - name: Accept-Language + value: en-US,en;q=0.9 + - - name: Host + value: example.com + - name: User-Agent + value: Mozilla/5.0 + - name: Accept-Encoding + value: gzip + - name: Accept-Encoding + value: deflate + method: + type: string + description: >- + The original HTTP method of the request. If supported in your + runtime, preserve the original casing. + examples: + - GET + - POST + - PUT + - PATCH + - DELETE + url: + type: string + description: >- + Absolute URL of the request, without a \#fragment suffix. Only HTTP + and HTTPS schemes are supported. + format: uri + examples: + - http://example.com + - https://example.com/checkout?method=card + ipv4_address: + type: string + description: Client IPv4 address observed by your server. + format: ipv4 + examples: + - 34.162.244.71 + - 3.208.0.3 + - 173.56.0.4 + ipv6_address: + type: string + description: Client IPv6 address observed by your server. + format: ipv6 + examples: + - 2001:4860:4801:10::1 + - 2600:1f42:abcd:5678:9876:fedc:1357:2468 + - 2001:4868:85f:1a2b:3c4d:5e6f:7890:abcd + - ::ffff:22a2:f447 + - ::ffff:34.162.244.71 + linked_id: + $ref: '#/components/schemas/LinkedId' + tags: + $ref: '#/components/schemas/Tags' EventId: type: string examples: @@ -1176,19 +1402,6 @@ components: format: int64 examples: - 1708102555327 - EventSource: - type: string - description: > - Identifies how the event was generated. - - - `device` - the event was generated by the JS agent or a mobile SDK - running on an end-user device. - - - `edge` - the event was generated by the Automation Intelligence API - (`/edge` endpoint), analyzing a request intercepted at the edge. - enum: - - device - - edge Url: type: string examples: @@ -1596,6 +1809,78 @@ components: description: > `true` if the request came from a device running a VPN, `false` otherwise. + EventSource: + type: string + description: > + Identifies how the event was generated. + + - `device` - the event was generated by the JS agent or a mobile SDK + running on an end-user device. + + - `edge` - the event was generated by the Automation Intelligence API + (`/edge` endpoint), analyzing a request intercepted at the edge. + enum: + - device + - edge + EventEdge: + type: object + description: > + IP and bot analysis for an event generated by the Automation + Intelligence API (`/edge` endpoint). No client-side collection agent is + involved, so Identification (`visitor_id`) and device-telemetry-derived + Smart Signals are not available. + properties: + event_id: + $ref: '#/components/schemas/EventId' + x-platforms: + - android + - ios + - browser + timestamp: + $ref: '#/components/schemas/Timestamp' + x-platforms: + - android + - ios + - browser + linked_id: + $ref: '#/components/schemas/LinkedId' + x-platforms: + - android + - ios + - browser + tags: + $ref: '#/components/schemas/Tags' + x-platforms: + - android + - ios + - browser + url: + $ref: '#/components/schemas/Url' + bot_info: + $ref: '#/components/schemas/BotInfo' + ip_info: + $ref: '#/components/schemas/IPInfo' + proxy: + $ref: '#/components/schemas/Proxy' + proxy_confidence: + $ref: '#/components/schemas/ProxyConfidence' + proxy_details: + $ref: '#/components/schemas/ProxyDetails' + vpn: + $ref: '#/components/schemas/Vpn' + vpn_confidence: + $ref: '#/components/schemas/VpnConfidence' + vpn_methods: + $ref: '#/components/schemas/VpnMethods' + source: + allOf: + - $ref: '#/components/schemas/EventSource' + - const: edge + required: + - event_id + - timestamp + - source + - ip_info ErrorCode: type: string enum: @@ -1715,7 +2000,7 @@ components: description: >- Field is `true` if you have previously set the `suspect` flag for this event using the [Server API Update event - endpoint](https://docs.fingerprint.com/reference/server-api-v4-update-event). + endpoint](https://docs.fingerprint.com/reference/server-api-update-event). Integration: type: object required: [] @@ -3084,16 +3369,18 @@ components: team](https://fingerprint.com/support/). Event: type: object - description: >- - Contains results from Fingerprint Identification and all active Smart - Signals. Some Smart Signals are only supported for certain device types, - these fields will be omitted for events not generated from the supported - devices. Consult the [Smart Signals + description: > + An identification event (`source: device`) or an Automation Intelligence + event (`source: edge`). + + + Use `source` to tell them apart. Device events include Identification + and device-derived Smart Signals. Edge events do not. + + + Consult the [Smart Signals reference](https://docs.fingerprint.com/docs/smart-signals-reference) for more details. - required: - - event_id - - timestamp properties: event_id: $ref: '#/components/schemas/EventId' @@ -3107,22 +3394,78 @@ components: - android - ios - browser - source: - $ref: '#/components/schemas/EventSource' + linked_id: + $ref: '#/components/schemas/LinkedId' x-platforms: - android - ios - browser - incremental_identification_status: - $ref: '#/components/schemas/IncrementalIdentificationStatus' + tags: + $ref: '#/components/schemas/Tags' x-platforms: + - android + - ios - browser - linked_id: - $ref: '#/components/schemas/LinkedId' + url: + $ref: '#/components/schemas/Url' + x-platforms: + - browser + bot_info: + $ref: '#/components/schemas/BotInfo' + x-platforms: + - browser + ip_info: + $ref: '#/components/schemas/IPInfo' + x-platforms: + - android + - ios + - browser + proxy: + $ref: '#/components/schemas/Proxy' + x-platforms: + - android + - ios + - browser + proxy_confidence: + $ref: '#/components/schemas/ProxyConfidence' x-platforms: - android - ios - browser + proxy_details: + $ref: '#/components/schemas/ProxyDetails' + x-platforms: + - android + - ios + - browser + vpn: + $ref: '#/components/schemas/Vpn' + x-platforms: + - android + - ios + - browser + vpn_confidence: + $ref: '#/components/schemas/VpnConfidence' + x-platforms: + - android + - ios + - browser + vpn_methods: + $ref: '#/components/schemas/VpnMethods' + x-platforms: + - android + - ios + - browser + source: + $ref: '#/components/schemas/EventSource' + x-platforms: + - android + - ios + - browser + incremental_identification_status: + $ref: '#/components/schemas/IncrementalIdentificationStatus' + x-platforms: + - browser environment_id: $ref: '#/components/schemas/EnvironmentId' x-platforms: @@ -3159,16 +3502,6 @@ components: - android - ios - browser - tags: - $ref: '#/components/schemas/Tags' - x-platforms: - - android - - ios - - browser - url: - $ref: '#/components/schemas/Url' - x-platforms: - - browser bundle_id: $ref: '#/components/schemas/BundleId' x-platforms: @@ -3234,10 +3567,6 @@ components: $ref: '#/components/schemas/BotType' x-platforms: - browser - bot_info: - $ref: '#/components/schemas/BotInfo' - x-platforms: - - browser cloned_app: $ref: '#/components/schemas/ClonedApp' x-platforms: @@ -3268,30 +3597,6 @@ components: - android - ios - browser - ip_info: - $ref: '#/components/schemas/IPInfo' - x-platforms: - - android - - ios - - browser - proxy: - $ref: '#/components/schemas/Proxy' - x-platforms: - - android - - ios - - browser - proxy_confidence: - $ref: '#/components/schemas/ProxyConfidence' - x-platforms: - - android - - ios - - browser - proxy_details: - $ref: '#/components/schemas/ProxyDetails' - x-platforms: - - android - - ios - - browser proxy_ml_score: $ref: '#/components/schemas/ProxyMLScore' x-platforms: @@ -3372,18 +3677,6 @@ components: $ref: '#/components/schemas/VirtualMachineMLScore' x-platforms: - browser - vpn: - $ref: '#/components/schemas/Vpn' - x-platforms: - - android - - ios - - browser - vpn_confidence: - $ref: '#/components/schemas/VpnConfidence' - x-platforms: - - android - - ios - - browser vpn_ml_score: $ref: '#/components/schemas/VpnMLScore' x-platforms: @@ -3399,12 +3692,6 @@ components: x-platforms: - android - ios - vpn_methods: - $ref: '#/components/schemas/VpnMethods' - x-platforms: - - android - - ios - - browser high_activity_device: $ref: '#/components/schemas/HighActivity' x-platforms: @@ -3431,6 +3718,9 @@ components: - browser - ios - android + required: + - event_id + - timestamp EventUpdate: type: object required: [] diff --git a/sync.sh b/sync.sh index 32ce5705..e640374e 100755 --- a/sync.sh +++ b/sync.sh @@ -2,12 +2,22 @@ set -euo pipefail defaultBaseUrl="https://fingerprintjs.github.io/fingerprint-pro-server-api-openapi" -schemaUrl="${1:-$defaultBaseUrl/schemas/fingerprint-server-api-v4.yaml}" +# Flattened Event (single object, source optional). start/end stay a date|int oneOf. +flatSchemaUrl="$defaultBaseUrl/schemas/fingerprint-server-api-v4-flat.yaml" +fallbackSchemaUrl="$defaultBaseUrl/schemas/fingerprint-server-api-v4.yaml" +schemaUrl="${1:-$flatSchemaUrl}" examplesBaseUrl="${2:-$defaultBaseUrl/examples}" mkdir -p ./res -curl -fSL --retry 3 -o ./res/fingerprint-server-api.yaml "$schemaUrl" +if ! curl -fSL --retry 3 -o ./res/fingerprint-server-api.yaml "$schemaUrl"; then + if [ -z "${1:-}" ]; then + echo "Failed to download $schemaUrl, falling back to $fallbackSchemaUrl" >&2 + curl -fSL --retry 3 -o ./res/fingerprint-server-api.yaml "$fallbackSchemaUrl" + else + exit 1 + fi +fi examples=( 'events/search/get_event_search_200.json' diff --git a/test/mocks/edge/post_edge_200.json b/test/mocks/edge/post_edge_200.json new file mode 100644 index 00000000..82bb295f --- /dev/null +++ b/test/mocks/edge/post_edge_200.json @@ -0,0 +1,10 @@ +{ + "event_id": "1700000000000.AbCdEf", + "timestamp": 1700000000000, + "source": "edge", + "ip_info": { + "v4": { + "address": "34.162.244.71" + } + } +} diff --git a/test/test_fingerprint_api.py b/test/test_fingerprint_api.py index 6ee8c73d..bf4b7878 100644 --- a/test/test_fingerprint_api.py +++ b/test/test_fingerprint_api.py @@ -9,9 +9,12 @@ BotInfoIdentity, Configuration, ConflictException, + EdgeRequest, + EdgeRequestHeadersInner, ErrorCode, ErrorResponse, Event, + EventEdge, EventSearch, EventUpdate, ForbiddenException, @@ -83,6 +86,74 @@ def delete_visitor_path(visitor_id, region: Region = Region.US): base = Configuration.get_host(region) return f'{base}/visitors/{visitor_id}' + @staticmethod + def get_edge_path(region: Region = Region.US): + base = Configuration.get_host(region) + return f'{base}/edge' + + def test_analyze_request_for_automation_intelligence(self) -> None: + """Test case for analyze_request_for_automation_intelligence + + Collect Automation Intelligence. + """ + mock_pool = MockPoolManager(self) + self.api.api_client.rest_client.pool_manager = mock_pool + edge_request = EdgeRequest( + headers=[EdgeRequestHeadersInner(name='Host', value='example.com')], + method='GET', + url='https://example.com/login', + ipv4_address='34.162.244.71', + ) + mock_pool.expect_request( + 'POST', + TestFingerprintApi.get_edge_path(), + headers=self.request_headers, + preload_content=True, + timeout=None, + body=( + '{"headers": [{"name": "Host", "value": "example.com"}], ' + '"method": "GET", "url": "https://example.com/login", ' + '"ipv4_address": "34.162.244.71"}' + ), + response_data_file='edge/post_edge_200.json', + ) + + event_edge_response = self.api.analyze_request_for_automation_intelligence(edge_request) + self.assertIsInstance(event_edge_response, EventEdge) + self.assertEqual(event_edge_response.source, 'edge') + + def test_analyze_request_for_automation_intelligence_bad_request(self) -> None: + """Test case for analyze_request_for_automation_intelligence with 400 Bad Request""" + mock_pool = MockPoolManager(self) + self.api.api_client.rest_client.pool_manager = mock_pool + edge_request = EdgeRequest( + headers=[EdgeRequestHeadersInner(name='Host', value='example.com')], + method='GET', + url='https://example.com/login', + ipv4_address='34.162.244.71', + ) + mock_pool.expect_request( + 'POST', + TestFingerprintApi.get_edge_path(), + headers=self.request_headers, + preload_content=True, + timeout=None, + body=( + '{"headers": [{"name": "Host", "value": "example.com"}], ' + '"method": "GET", "url": "https://example.com/login", ' + '"ipv4_address": "34.162.244.71"}' + ), + response_status_code=400, + response_data_file='errors/400_request_body_invalid.json', + ) + + with self.assertRaises(BadRequestException) as context: + self.api.analyze_request_for_automation_intelligence(edge_request) + + self.assertEqual(context.exception.status, 400) + self.assertIsInstance(context.exception.data, ErrorResponse) + self.assertEqual(context.exception.data.error.code, ErrorCode.REQUEST_CANNOT_BE_PARSED) + def test_delete_visitor_data(self) -> None: """Test case for delete_visitor_data @@ -435,8 +506,8 @@ def test_search_events_all_params(self) -> None: 'bot_info_confidence': [BotInfoConfidence.HIGH, BotInfoConfidence.MEDIUM], 'bot_info_provider': ['provider'], 'bot_info_name': ['name1', 'name2'], - 'source': [SearchEventsSource.EDGE], 'active_call': True, + 'source': [SearchEventsSource.EDGE], } # URL params use serialized values (enum.value, lowercase bool) in API definition order url_params = { @@ -489,8 +560,8 @@ def test_search_events_all_params(self) -> None: 'tor_node': 'true', 'incremental_identification_status': 'partially_completed', 'simulator': 'true', - 'source': ['edge'], 'active_call': 'true', + 'source': ['edge'], } mock_pool = MockPoolManager(self)