opportify-sdk 0.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. lib/__init__.py +0 -0
  2. lib/v1/__init__.py +0 -0
  3. lib/v1/openapi_client/__init__.py +63 -0
  4. lib/v1/openapi_client/api/__init__.py +6 -0
  5. lib/v1/openapi_client/api/email_insights_api.py +317 -0
  6. lib/v1/openapi_client/api/ip_insights_api.py +322 -0
  7. lib/v1/openapi_client/api_client.py +797 -0
  8. lib/v1/openapi_client/api_response.py +21 -0
  9. lib/v1/openapi_client/configuration.py +595 -0
  10. lib/v1/openapi_client/exceptions.py +199 -0
  11. lib/v1/openapi_client/models/__init__.py +45 -0
  12. lib/v1/openapi_client/models/abuse_contact.py +99 -0
  13. lib/v1/openapi_client/models/admin_contact.py +99 -0
  14. lib/v1/openapi_client/models/analyze_email200_response.py +113 -0
  15. lib/v1/openapi_client/models/analyze_email400_response.py +91 -0
  16. lib/v1/openapi_client/models/analyze_email400_response_error.py +137 -0
  17. lib/v1/openapi_client/models/analyze_email500_response.py +91 -0
  18. lib/v1/openapi_client/models/analyze_email500_response_error.py +89 -0
  19. lib/v1/openapi_client/models/analyze_email_request.py +92 -0
  20. lib/v1/openapi_client/models/analyze_ip200_response.py +127 -0
  21. lib/v1/openapi_client/models/analyze_ip400_response.py +91 -0
  22. lib/v1/openapi_client/models/analyze_ip400_response_error.py +137 -0
  23. lib/v1/openapi_client/models/analyze_ip404_response.py +91 -0
  24. lib/v1/openapi_client/models/analyze_ip500_response.py +91 -0
  25. lib/v1/openapi_client/models/analyze_ip_request.py +89 -0
  26. lib/v1/openapi_client/models/asn.py +93 -0
  27. lib/v1/openapi_client/models/block_listed.py +94 -0
  28. lib/v1/openapi_client/models/email_dns.py +87 -0
  29. lib/v1/openapi_client/models/geo.py +113 -0
  30. lib/v1/openapi_client/models/internalerror.py +89 -0
  31. lib/v1/openapi_client/models/invalidemail.py +89 -0
  32. lib/v1/openapi_client/models/ipvalidationfailed.py +89 -0
  33. lib/v1/openapi_client/models/malformedrequest.py +89 -0
  34. lib/v1/openapi_client/models/malformedrequest1.py +89 -0
  35. lib/v1/openapi_client/models/notfound.py +89 -0
  36. lib/v1/openapi_client/models/organization.py +103 -0
  37. lib/v1/openapi_client/models/risk_report.py +89 -0
  38. lib/v1/openapi_client/models/tech_contact.py +99 -0
  39. lib/v1/openapi_client/models/trusted_provider.py +93 -0
  40. lib/v1/openapi_client/models/whois.py +117 -0
  41. lib/v1/openapi_client/py.typed +0 -0
  42. lib/v1/openapi_client/rest.py +257 -0
  43. opportify_sdk-0.1.0.dist-info/METADATA +16 -0
  44. opportify_sdk-0.1.0.dist-info/RECORD +49 -0
  45. opportify_sdk-0.1.0.dist-info/WHEEL +5 -0
  46. opportify_sdk-0.1.0.dist-info/top_level.txt +2 -0
  47. src/__init__.py +6 -0
  48. src/email_insights.py +97 -0
  49. src/ip_insights.py +93 -0
@@ -0,0 +1,322 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Opportify Insights API
5
+
6
+ ## Overview The **Opportify Insights API** provides access to a powerful and up-to-date platform. With advanced data warehousing and AI-driven capabilities, this API is designed to empower your business to make informed, data-driven decisions and effectively assess potential risks. ### Base URL Use the following base URL for all API requests: ```plaintext https://api.opportify.ai/insights/v1/<service>/<endpoint> ``` ### Features - [**Email Insights:**](/docs/api-reference/email-insights) - Validate email syntax. - Identify email types (free, disposable, corporate or unknown). - Real time verifications: - Reachable: Confirms if the email domain has valid MX DNS records using DNS lookup. - Deliverable: Simulates an SMTP handshake to check if the email address exists and is deliverable. - Catch-All: Detects if the domain accepts all emails (catch-all configuration). - Intelligent Error Correction: Automatically corrects well-known misspelled email addresses. - Risk Report: Provides an AI-driven normalized score (200-1000) to evaluate email risk, using predefined thresholds. [Access Documentation >>](/docs/api-reference/email-insights) - [**IP Insights:**](/docs/api-reference/ip-insights) - Connection types: Detects connection types such as `wired`, `mobile`, `enterprise`, `satellite`, `VPN`, `cloud-provider`, `open-proxy`, or `Tor`. - Geo location: Delivers detailed insights such as country, city, timezone, language preferences, and additional location-based information to enhance regional understanding. - WHOIS: Provides main details including RIR, ASN, organization, and abuse/admin/technical contacts. - Trusted Provider Recognition: Identifies if the IP is part of a known trusted provider (e.g., ZTNA - Zero Trust Network Access). - Blocklist Reports: Retrieves up-to-date blocklist statuses, active reports, and the latest detections. - Risk Report: Delivers an AI-driven normalized score (200-1000) to evaluate IP risk, supported by predefined thresholds. [Access Documentation >>](/docs/api-reference/ip-insights) ### Authentication & Security - **API Key:** Access to the API requires an API key, which must be included in the request headers. Businesses can generate unlimited API keys directly from their account, offering flexibility and ease of use. - **ACL Rules:** Enhance security with Access Control Lists (ACL), allowing you to restrict API access from specific IP addresses or ranges. This feature provides an additional layer of protection by ensuring only authorized IPs can interact with the API. - **No Query Parameters:** As a precautionary measure, our API avoids the use of query parameters for all operations, including authentication and handling Personally Identifiable Information (PII). This approach minimizes security risks by preventing sensitive data from being exposed in access logs, browser history, cached URLs, debugging tools, or inadvertently shared URLs. All sensitive information is securely transmitted through headers or the request body.
7
+
8
+ The version of the OpenAPI document: 1.0.0
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501
13
+
14
+ import warnings
15
+ from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt
16
+ from typing import Any, Dict, List, Optional, Tuple, Union
17
+ from typing_extensions import Annotated
18
+
19
+ from openapi_client.models.analyze_ip200_response import AnalyzeIp200Response
20
+ from openapi_client.models.analyze_ip_request import AnalyzeIpRequest
21
+
22
+ from openapi_client.api_client import ApiClient, RequestSerialized
23
+ from openapi_client.api_response import ApiResponse
24
+ from openapi_client.rest import RESTResponseType
25
+
26
+
27
+ class IPInsightsApi:
28
+ """NOTE: This class is auto generated by OpenAPI Generator
29
+ Ref: https://openapi-generator.tech
30
+
31
+ Do not edit the class manually.
32
+ """
33
+
34
+ def __init__(self, api_client=None) -> None:
35
+ if api_client is None:
36
+ api_client = ApiClient.get_default()
37
+ self.api_client = api_client
38
+
39
+
40
+ @validate_call
41
+ def analyze_ip(
42
+ self,
43
+ analyze_ip_request: AnalyzeIpRequest,
44
+ _request_timeout: Union[
45
+ None,
46
+ Annotated[StrictFloat, Field(gt=0)],
47
+ Tuple[
48
+ Annotated[StrictFloat, Field(gt=0)],
49
+ Annotated[StrictFloat, Field(gt=0)]
50
+ ]
51
+ ] = None,
52
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
53
+ _content_type: Optional[StrictStr] = None,
54
+ _headers: Optional[Dict[StrictStr, Any]] = None,
55
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
56
+ ) -> AnalyzeIp200Response:
57
+ """Analyze IP
58
+
59
+ The **Analyze IP** endpoint provides comprehensive insights into a specified IP address, leveraging AI-driven analysis to deliver actionable intelligence. This includes connection type identification, detailed geolocation data, WHOIS information, trusted provider verification, up-to-date blocklist reports, and a robust risk assessment. Compatible with both IPv4 and IPv6, this endpoint is designed to empower businesses with precise and reliable IP data. ### Features: - Connection types: Detects connection types such as `wired`, `mobile`, `enterprise`, `satellite`, `vpn`, `cloud-provider`, `open-proxy`, or `Tor`. - Geo location: Delivers detailed insights such as country, city, timezone, language preferences, and additional location-based information to enhance regional understanding. - WHOIS: Provides main details including RIR, ASN, organization, and abuse/admin/technical contacts. - Trusted Provider Recognition: Identifies if the IP is part of a known trusted provider (e.g., ZTNA - Zero Trust Network Access). - Blocklist Reports: Retrieves up-to-date blocklist statuses, active reports, and the latest detections. - Risk Report: Delivers an AI-driven normalized score (200-1000) to evaluate IP risk, supported by predefined thresholds. ### Example Request Body: ```json { \"ip\": \"192.168.0.1\", \"enableAI\": true } ``` ### Authentication & Security - **API Key:** Access to the API requires an API key, which must be included in the request headers. Businesses can generate unlimited API keys directly from their account, offering flexibility and ease of use. - **ACL Rules:** Enhance security with Access Control Lists (ACL), allowing you to restrict API access from specific IP addresses or ranges. This feature provides an additional layer of protection by ensuring only authorized IPs can interact with the API. - **No Query Parameters:** As a precautionary measure, our API avoids the use of query parameters for all operations, including authentication and handling Personally Identifiable Information (PII). This approach minimizes security risks by preventing sensitive data from being exposed in access logs, browser history, cached URLs, debugging tools, or inadvertently shared URLs. All sensitive information is securely transmitted through headers or the request body.
60
+
61
+ :param analyze_ip_request: (required)
62
+ :type analyze_ip_request: AnalyzeIpRequest
63
+ :param _request_timeout: timeout setting for this request. If one
64
+ number provided, it will be total request
65
+ timeout. It can also be a pair (tuple) of
66
+ (connection, read) timeouts.
67
+ :type _request_timeout: int, tuple(int, int), optional
68
+ :param _request_auth: set to override the auth_settings for an a single
69
+ request; this effectively ignores the
70
+ authentication in the spec for a single request.
71
+ :type _request_auth: dict, optional
72
+ :param _content_type: force content-type for the request.
73
+ :type _content_type: str, Optional
74
+ :param _headers: set to override the headers for a single
75
+ request; this effectively ignores the headers
76
+ in the spec for a single request.
77
+ :type _headers: dict, optional
78
+ :param _host_index: set to override the host_index for a single
79
+ request; this effectively ignores the host_index
80
+ in the spec for a single request.
81
+ :type _host_index: int, optional
82
+ :return: Returns the result object.
83
+ """ # noqa: E501
84
+
85
+ _param = self._analyze_ip_serialize(
86
+ analyze_ip_request=analyze_ip_request,
87
+ _request_auth=_request_auth,
88
+ _content_type=_content_type,
89
+ _headers=_headers,
90
+ _host_index=_host_index
91
+ )
92
+
93
+ print ("_param", _param)
94
+
95
+ _response_types_map: Dict[str, Optional[str]] = {
96
+ '200': "AnalyzeIp200Response",
97
+ '400': "AnalyzeIp400Response",
98
+ '404': "AnalyzeIp404Response",
99
+ '500': "AnalyzeIp500Response",
100
+ }
101
+ response_data = self.api_client.call_api(
102
+ *_param,
103
+ _request_timeout=_request_timeout
104
+ )
105
+ response_data.read()
106
+ return self.api_client.response_deserialize(
107
+ response_data=response_data,
108
+ response_types_map=_response_types_map,
109
+ ).data
110
+
111
+
112
+ @validate_call
113
+ def analyze_ip_with_http_info(
114
+ self,
115
+ analyze_ip_request: AnalyzeIpRequest,
116
+ _request_timeout: Union[
117
+ None,
118
+ Annotated[StrictFloat, Field(gt=0)],
119
+ Tuple[
120
+ Annotated[StrictFloat, Field(gt=0)],
121
+ Annotated[StrictFloat, Field(gt=0)]
122
+ ]
123
+ ] = None,
124
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
125
+ _content_type: Optional[StrictStr] = None,
126
+ _headers: Optional[Dict[StrictStr, Any]] = None,
127
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
128
+ ) -> ApiResponse[AnalyzeIp200Response]:
129
+ """Analyze IP
130
+
131
+ The **Analyze IP** endpoint provides comprehensive insights into a specified IP address, leveraging AI-driven analysis to deliver actionable intelligence. This includes connection type identification, detailed geolocation data, WHOIS information, trusted provider verification, up-to-date blocklist reports, and a robust risk assessment. Compatible with both IPv4 and IPv6, this endpoint is designed to empower businesses with precise and reliable IP data. ### Features: - Connection types: Detects connection types such as `wired`, `mobile`, `enterprise`, `satellite`, `vpn`, `cloud-provider`, `open-proxy`, or `Tor`. - Geo location: Delivers detailed insights such as country, city, timezone, language preferences, and additional location-based information to enhance regional understanding. - WHOIS: Provides main details including RIR, ASN, organization, and abuse/admin/technical contacts. - Trusted Provider Recognition: Identifies if the IP is part of a known trusted provider (e.g., ZTNA - Zero Trust Network Access). - Blocklist Reports: Retrieves up-to-date blocklist statuses, active reports, and the latest detections. - Risk Report: Delivers an AI-driven normalized score (200-1000) to evaluate IP risk, supported by predefined thresholds. ### Example Request Body: ```json { \"ip\": \"192.168.0.1\", \"enableAI\": true } ``` ### Authentication & Security - **API Key:** Access to the API requires an API key, which must be included in the request headers. Businesses can generate unlimited API keys directly from their account, offering flexibility and ease of use. - **ACL Rules:** Enhance security with Access Control Lists (ACL), allowing you to restrict API access from specific IP addresses or ranges. This feature provides an additional layer of protection by ensuring only authorized IPs can interact with the API. - **No Query Parameters:** As a precautionary measure, our API avoids the use of query parameters for all operations, including authentication and handling Personally Identifiable Information (PII). This approach minimizes security risks by preventing sensitive data from being exposed in access logs, browser history, cached URLs, debugging tools, or inadvertently shared URLs. All sensitive information is securely transmitted through headers or the request body.
132
+
133
+ :param analyze_ip_request: (required)
134
+ :type analyze_ip_request: AnalyzeIpRequest
135
+ :param _request_timeout: timeout setting for this request. If one
136
+ number provided, it will be total request
137
+ timeout. It can also be a pair (tuple) of
138
+ (connection, read) timeouts.
139
+ :type _request_timeout: int, tuple(int, int), optional
140
+ :param _request_auth: set to override the auth_settings for an a single
141
+ request; this effectively ignores the
142
+ authentication in the spec for a single request.
143
+ :type _request_auth: dict, optional
144
+ :param _content_type: force content-type for the request.
145
+ :type _content_type: str, Optional
146
+ :param _headers: set to override the headers for a single
147
+ request; this effectively ignores the headers
148
+ in the spec for a single request.
149
+ :type _headers: dict, optional
150
+ :param _host_index: set to override the host_index for a single
151
+ request; this effectively ignores the host_index
152
+ in the spec for a single request.
153
+ :type _host_index: int, optional
154
+ :return: Returns the result object.
155
+ """ # noqa: E501
156
+
157
+ _param = self._analyze_ip_serialize(
158
+ analyze_ip_request=analyze_ip_request,
159
+ _request_auth=_request_auth,
160
+ _content_type=_content_type,
161
+ _headers=_headers,
162
+ _host_index=_host_index
163
+ )
164
+
165
+ _response_types_map: Dict[str, Optional[str]] = {
166
+ '200': "AnalyzeIp200Response",
167
+ '400': "AnalyzeIp400Response",
168
+ '404': "AnalyzeIp404Response",
169
+ '500': "AnalyzeIp500Response",
170
+ }
171
+ response_data = self.api_client.call_api(
172
+ *_param,
173
+ _request_timeout=_request_timeout
174
+ )
175
+ response_data.read()
176
+ return self.api_client.response_deserialize(
177
+ response_data=response_data,
178
+ response_types_map=_response_types_map,
179
+ )
180
+
181
+
182
+ @validate_call
183
+ def analyze_ip_without_preload_content(
184
+ self,
185
+ analyze_ip_request: AnalyzeIpRequest,
186
+ _request_timeout: Union[
187
+ None,
188
+ Annotated[StrictFloat, Field(gt=0)],
189
+ Tuple[
190
+ Annotated[StrictFloat, Field(gt=0)],
191
+ Annotated[StrictFloat, Field(gt=0)]
192
+ ]
193
+ ] = None,
194
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
195
+ _content_type: Optional[StrictStr] = None,
196
+ _headers: Optional[Dict[StrictStr, Any]] = None,
197
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
198
+ ) -> RESTResponseType:
199
+ """Analyze IP
200
+
201
+ The **Analyze IP** endpoint provides comprehensive insights into a specified IP address, leveraging AI-driven analysis to deliver actionable intelligence. This includes connection type identification, detailed geolocation data, WHOIS information, trusted provider verification, up-to-date blocklist reports, and a robust risk assessment. Compatible with both IPv4 and IPv6, this endpoint is designed to empower businesses with precise and reliable IP data. ### Features: - Connection types: Detects connection types such as `wired`, `mobile`, `enterprise`, `satellite`, `vpn`, `cloud-provider`, `open-proxy`, or `Tor`. - Geo location: Delivers detailed insights such as country, city, timezone, language preferences, and additional location-based information to enhance regional understanding. - WHOIS: Provides main details including RIR, ASN, organization, and abuse/admin/technical contacts. - Trusted Provider Recognition: Identifies if the IP is part of a known trusted provider (e.g., ZTNA - Zero Trust Network Access). - Blocklist Reports: Retrieves up-to-date blocklist statuses, active reports, and the latest detections. - Risk Report: Delivers an AI-driven normalized score (200-1000) to evaluate IP risk, supported by predefined thresholds. ### Example Request Body: ```json { \"ip\": \"192.168.0.1\", \"enableAI\": true } ``` ### Authentication & Security - **API Key:** Access to the API requires an API key, which must be included in the request headers. Businesses can generate unlimited API keys directly from their account, offering flexibility and ease of use. - **ACL Rules:** Enhance security with Access Control Lists (ACL), allowing you to restrict API access from specific IP addresses or ranges. This feature provides an additional layer of protection by ensuring only authorized IPs can interact with the API. - **No Query Parameters:** As a precautionary measure, our API avoids the use of query parameters for all operations, including authentication and handling Personally Identifiable Information (PII). This approach minimizes security risks by preventing sensitive data from being exposed in access logs, browser history, cached URLs, debugging tools, or inadvertently shared URLs. All sensitive information is securely transmitted through headers or the request body.
202
+
203
+ :param analyze_ip_request: (required)
204
+ :type analyze_ip_request: AnalyzeIpRequest
205
+ :param _request_timeout: timeout setting for this request. If one
206
+ number provided, it will be total request
207
+ timeout. It can also be a pair (tuple) of
208
+ (connection, read) timeouts.
209
+ :type _request_timeout: int, tuple(int, int), optional
210
+ :param _request_auth: set to override the auth_settings for an a single
211
+ request; this effectively ignores the
212
+ authentication in the spec for a single request.
213
+ :type _request_auth: dict, optional
214
+ :param _content_type: force content-type for the request.
215
+ :type _content_type: str, Optional
216
+ :param _headers: set to override the headers for a single
217
+ request; this effectively ignores the headers
218
+ in the spec for a single request.
219
+ :type _headers: dict, optional
220
+ :param _host_index: set to override the host_index for a single
221
+ request; this effectively ignores the host_index
222
+ in the spec for a single request.
223
+ :type _host_index: int, optional
224
+ :return: Returns the result object.
225
+ """ # noqa: E501
226
+
227
+ _param = self._analyze_ip_serialize(
228
+ analyze_ip_request=analyze_ip_request,
229
+ _request_auth=_request_auth,
230
+ _content_type=_content_type,
231
+ _headers=_headers,
232
+ _host_index=_host_index
233
+ )
234
+
235
+ _response_types_map: Dict[str, Optional[str]] = {
236
+ '200': "AnalyzeIp200Response",
237
+ '400': "AnalyzeIp400Response",
238
+ '404': "AnalyzeIp404Response",
239
+ '500': "AnalyzeIp500Response",
240
+ }
241
+ response_data = self.api_client.call_api(
242
+ *_param,
243
+ _request_timeout=_request_timeout
244
+ )
245
+ return response_data.response
246
+
247
+
248
+ def _analyze_ip_serialize(
249
+ self,
250
+ analyze_ip_request,
251
+ _request_auth,
252
+ _content_type,
253
+ _headers,
254
+ _host_index,
255
+ ) -> RequestSerialized:
256
+
257
+ _host = None
258
+
259
+ _collection_formats: Dict[str, str] = {
260
+ }
261
+
262
+ _path_params: Dict[str, str] = {}
263
+ _query_params: List[Tuple[str, str]] = []
264
+ _header_params: Dict[str, Optional[str]] = _headers or {}
265
+ _form_params: List[Tuple[str, str]] = []
266
+ _files: Dict[
267
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
268
+ ] = {}
269
+ _body_params: Optional[bytes] = None
270
+
271
+ # process the path parameters
272
+ # process the query parameters
273
+ # process the header parameters
274
+ # process the form parameters
275
+ # process the body parameter
276
+ if analyze_ip_request is not None:
277
+ _body_params = analyze_ip_request
278
+
279
+
280
+ # set the HTTP header `Accept`
281
+ if 'Accept' not in _header_params:
282
+ _header_params['Accept'] = self.api_client.select_header_accept(
283
+ [
284
+ 'application/json'
285
+ ]
286
+ )
287
+
288
+ # set the HTTP header `Content-Type`
289
+ if _content_type:
290
+ _header_params['Content-Type'] = _content_type
291
+ else:
292
+ _default_content_type = (
293
+ self.api_client.select_header_content_type(
294
+ [
295
+ 'application/json'
296
+ ]
297
+ )
298
+ )
299
+ if _default_content_type is not None:
300
+ _header_params['Content-Type'] = _default_content_type
301
+
302
+ # authentication setting
303
+ _auth_settings: List[str] = [
304
+ 'opportifyToken'
305
+ ]
306
+
307
+ return self.api_client.param_serialize(
308
+ method='POST',
309
+ resource_path='/ip/analyze',
310
+ path_params=_path_params,
311
+ query_params=_query_params,
312
+ header_params=_header_params,
313
+ body=_body_params,
314
+ post_params=_form_params,
315
+ files=_files,
316
+ auth_settings=_auth_settings,
317
+ collection_formats=_collection_formats,
318
+ _host=_host,
319
+ _request_auth=_request_auth
320
+ )
321
+
322
+