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.
- lib/__init__.py +0 -0
- lib/v1/__init__.py +0 -0
- lib/v1/openapi_client/__init__.py +63 -0
- lib/v1/openapi_client/api/__init__.py +6 -0
- lib/v1/openapi_client/api/email_insights_api.py +317 -0
- lib/v1/openapi_client/api/ip_insights_api.py +322 -0
- lib/v1/openapi_client/api_client.py +797 -0
- lib/v1/openapi_client/api_response.py +21 -0
- lib/v1/openapi_client/configuration.py +595 -0
- lib/v1/openapi_client/exceptions.py +199 -0
- lib/v1/openapi_client/models/__init__.py +45 -0
- lib/v1/openapi_client/models/abuse_contact.py +99 -0
- lib/v1/openapi_client/models/admin_contact.py +99 -0
- lib/v1/openapi_client/models/analyze_email200_response.py +113 -0
- lib/v1/openapi_client/models/analyze_email400_response.py +91 -0
- lib/v1/openapi_client/models/analyze_email400_response_error.py +137 -0
- lib/v1/openapi_client/models/analyze_email500_response.py +91 -0
- lib/v1/openapi_client/models/analyze_email500_response_error.py +89 -0
- lib/v1/openapi_client/models/analyze_email_request.py +92 -0
- lib/v1/openapi_client/models/analyze_ip200_response.py +127 -0
- lib/v1/openapi_client/models/analyze_ip400_response.py +91 -0
- lib/v1/openapi_client/models/analyze_ip400_response_error.py +137 -0
- lib/v1/openapi_client/models/analyze_ip404_response.py +91 -0
- lib/v1/openapi_client/models/analyze_ip500_response.py +91 -0
- lib/v1/openapi_client/models/analyze_ip_request.py +89 -0
- lib/v1/openapi_client/models/asn.py +93 -0
- lib/v1/openapi_client/models/block_listed.py +94 -0
- lib/v1/openapi_client/models/email_dns.py +87 -0
- lib/v1/openapi_client/models/geo.py +113 -0
- lib/v1/openapi_client/models/internalerror.py +89 -0
- lib/v1/openapi_client/models/invalidemail.py +89 -0
- lib/v1/openapi_client/models/ipvalidationfailed.py +89 -0
- lib/v1/openapi_client/models/malformedrequest.py +89 -0
- lib/v1/openapi_client/models/malformedrequest1.py +89 -0
- lib/v1/openapi_client/models/notfound.py +89 -0
- lib/v1/openapi_client/models/organization.py +103 -0
- lib/v1/openapi_client/models/risk_report.py +89 -0
- lib/v1/openapi_client/models/tech_contact.py +99 -0
- lib/v1/openapi_client/models/trusted_provider.py +93 -0
- lib/v1/openapi_client/models/whois.py +117 -0
- lib/v1/openapi_client/py.typed +0 -0
- lib/v1/openapi_client/rest.py +257 -0
- opportify_sdk-0.1.0.dist-info/METADATA +16 -0
- opportify_sdk-0.1.0.dist-info/RECORD +49 -0
- opportify_sdk-0.1.0.dist-info/WHEEL +5 -0
- opportify_sdk-0.1.0.dist-info/top_level.txt +2 -0
- src/__init__.py +6 -0
- src/email_insights.py +97 -0
- src/ip_insights.py +93 -0
|
@@ -0,0 +1,93 @@
|
|
|
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
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
import pprint
|
|
17
|
+
import re # noqa: F401
|
|
18
|
+
import json
|
|
19
|
+
|
|
20
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr
|
|
21
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
|
22
|
+
from typing import Optional, Set
|
|
23
|
+
from typing_extensions import Self
|
|
24
|
+
|
|
25
|
+
class TrustedProvider(BaseModel):
|
|
26
|
+
"""
|
|
27
|
+
Details of trusted providers for an IP address.
|
|
28
|
+
""" # noqa: E501
|
|
29
|
+
is_known_provider: StrictBool = Field(description="Indicates if the IP belongs to a trusted provider.", alias="isKnownProvider")
|
|
30
|
+
provider: Optional[StrictStr] = Field(default=None, description="Name of the trusted provider.")
|
|
31
|
+
provider_type: Optional[StrictStr] = Field(default=None, description="Type of the trusted provider.", alias="providerType")
|
|
32
|
+
description: Optional[StrictStr] = Field(default=None, description="Provider a short description.")
|
|
33
|
+
__properties: ClassVar[List[str]] = ["isKnownProvider", "provider", "providerType", "description"]
|
|
34
|
+
|
|
35
|
+
model_config = ConfigDict(
|
|
36
|
+
populate_by_name=True,
|
|
37
|
+
validate_assignment=True,
|
|
38
|
+
protected_namespaces=(),
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def to_str(self) -> str:
|
|
43
|
+
"""Returns the string representation of the model using alias"""
|
|
44
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
45
|
+
|
|
46
|
+
def to_json(self) -> str:
|
|
47
|
+
"""Returns the JSON representation of the model using alias"""
|
|
48
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
49
|
+
return json.dumps(self.to_dict())
|
|
50
|
+
|
|
51
|
+
@classmethod
|
|
52
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
53
|
+
"""Create an instance of TrustedProvider from a JSON string"""
|
|
54
|
+
return cls.from_dict(json.loads(json_str))
|
|
55
|
+
|
|
56
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
57
|
+
"""Return the dictionary representation of the model using alias.
|
|
58
|
+
|
|
59
|
+
This has the following differences from calling pydantic's
|
|
60
|
+
`self.model_dump(by_alias=True)`:
|
|
61
|
+
|
|
62
|
+
* `None` is only added to the output dict for nullable fields that
|
|
63
|
+
were set at model initialization. Other fields with value `None`
|
|
64
|
+
are ignored.
|
|
65
|
+
"""
|
|
66
|
+
excluded_fields: Set[str] = set([
|
|
67
|
+
])
|
|
68
|
+
|
|
69
|
+
_dict = self.model_dump(
|
|
70
|
+
by_alias=True,
|
|
71
|
+
exclude=excluded_fields,
|
|
72
|
+
exclude_none=True,
|
|
73
|
+
)
|
|
74
|
+
return _dict
|
|
75
|
+
|
|
76
|
+
@classmethod
|
|
77
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
78
|
+
"""Create an instance of TrustedProvider from a dict"""
|
|
79
|
+
if obj is None:
|
|
80
|
+
return None
|
|
81
|
+
|
|
82
|
+
if not isinstance(obj, dict):
|
|
83
|
+
return cls.model_validate(obj)
|
|
84
|
+
|
|
85
|
+
_obj = cls.model_validate({
|
|
86
|
+
"isKnownProvider": obj.get("isKnownProvider"),
|
|
87
|
+
"provider": obj.get("provider"),
|
|
88
|
+
"providerType": obj.get("providerType"),
|
|
89
|
+
"description": obj.get("description")
|
|
90
|
+
})
|
|
91
|
+
return _obj
|
|
92
|
+
|
|
93
|
+
|
|
@@ -0,0 +1,117 @@
|
|
|
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
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
import pprint
|
|
17
|
+
import re # noqa: F401
|
|
18
|
+
import json
|
|
19
|
+
|
|
20
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictStr
|
|
21
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
|
22
|
+
from openapi_client.models.abuse_contact import AbuseContact
|
|
23
|
+
from openapi_client.models.admin_contact import AdminContact
|
|
24
|
+
from openapi_client.models.asn import Asn
|
|
25
|
+
from openapi_client.models.organization import Organization
|
|
26
|
+
from openapi_client.models.tech_contact import TechContact
|
|
27
|
+
from typing import Optional, Set
|
|
28
|
+
from typing_extensions import Self
|
|
29
|
+
|
|
30
|
+
class Whois(BaseModel):
|
|
31
|
+
"""
|
|
32
|
+
### WHOIS Details This object provides sanitized and normalized WHOIS information for an IP address, including details about the Regional Internet Registry (RIR), Autonomous System Number (ASN), organization, and contact information. --- > **IMPORTANT:** > While the WHOIS data we provide are publicly available and can be accessed through any Regional Internet Registry (RIR) by anyone, we prioritize data privacy. As such, details for address, phone number, and email are **not included in the free plan**. To access this information, you need to subscribe to a paid plan and comply with additional data privacy agreements. --- #### Key Features: - **RIR Details**: Identify the Regional Internet Registry managing the IP address. - **ASN Information**: Obtain the Autonomous System Number details, including the ASN identifier, name, and description. - **Organization Data**: Retrieve organization details, such as the ID, name, type, description, address, country, and contact information. - **Contact Information**: Access contact details for abuse, admin, and tech issues, including the contact ID, type, name, address, phone, fax, and email. --- ### Response Elements
|
|
33
|
+
""" # noqa: E501
|
|
34
|
+
rir: Optional[StrictStr] = Field(default=None, description="Regional Internet Registry managing the IP.")
|
|
35
|
+
asn: Optional[Asn] = None
|
|
36
|
+
organization: Optional[Organization] = None
|
|
37
|
+
abuse_contact: Optional[AbuseContact] = Field(default=None, alias="abuseContact")
|
|
38
|
+
admin_contact: Optional[AdminContact] = Field(default=None, alias="adminContact")
|
|
39
|
+
tech_contact: Optional[TechContact] = Field(default=None, alias="techContact")
|
|
40
|
+
__properties: ClassVar[List[str]] = ["rir", "asn", "organization", "abuseContact", "adminContact", "techContact"]
|
|
41
|
+
|
|
42
|
+
model_config = ConfigDict(
|
|
43
|
+
populate_by_name=True,
|
|
44
|
+
validate_assignment=True,
|
|
45
|
+
protected_namespaces=(),
|
|
46
|
+
)
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def to_str(self) -> str:
|
|
50
|
+
"""Returns the string representation of the model using alias"""
|
|
51
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
52
|
+
|
|
53
|
+
def to_json(self) -> str:
|
|
54
|
+
"""Returns the JSON representation of the model using alias"""
|
|
55
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
56
|
+
return json.dumps(self.to_dict())
|
|
57
|
+
|
|
58
|
+
@classmethod
|
|
59
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
60
|
+
"""Create an instance of Whois from a JSON string"""
|
|
61
|
+
return cls.from_dict(json.loads(json_str))
|
|
62
|
+
|
|
63
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
64
|
+
"""Return the dictionary representation of the model using alias.
|
|
65
|
+
|
|
66
|
+
This has the following differences from calling pydantic's
|
|
67
|
+
`self.model_dump(by_alias=True)`:
|
|
68
|
+
|
|
69
|
+
* `None` is only added to the output dict for nullable fields that
|
|
70
|
+
were set at model initialization. Other fields with value `None`
|
|
71
|
+
are ignored.
|
|
72
|
+
"""
|
|
73
|
+
excluded_fields: Set[str] = set([
|
|
74
|
+
])
|
|
75
|
+
|
|
76
|
+
_dict = self.model_dump(
|
|
77
|
+
by_alias=True,
|
|
78
|
+
exclude=excluded_fields,
|
|
79
|
+
exclude_none=True,
|
|
80
|
+
)
|
|
81
|
+
# override the default output from pydantic by calling `to_dict()` of asn
|
|
82
|
+
if self.asn:
|
|
83
|
+
_dict['asn'] = self.asn.to_dict()
|
|
84
|
+
# override the default output from pydantic by calling `to_dict()` of organization
|
|
85
|
+
if self.organization:
|
|
86
|
+
_dict['organization'] = self.organization.to_dict()
|
|
87
|
+
# override the default output from pydantic by calling `to_dict()` of abuse_contact
|
|
88
|
+
if self.abuse_contact:
|
|
89
|
+
_dict['abuseContact'] = self.abuse_contact.to_dict()
|
|
90
|
+
# override the default output from pydantic by calling `to_dict()` of admin_contact
|
|
91
|
+
if self.admin_contact:
|
|
92
|
+
_dict['adminContact'] = self.admin_contact.to_dict()
|
|
93
|
+
# override the default output from pydantic by calling `to_dict()` of tech_contact
|
|
94
|
+
if self.tech_contact:
|
|
95
|
+
_dict['techContact'] = self.tech_contact.to_dict()
|
|
96
|
+
return _dict
|
|
97
|
+
|
|
98
|
+
@classmethod
|
|
99
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
100
|
+
"""Create an instance of Whois from a dict"""
|
|
101
|
+
if obj is None:
|
|
102
|
+
return None
|
|
103
|
+
|
|
104
|
+
if not isinstance(obj, dict):
|
|
105
|
+
return cls.model_validate(obj)
|
|
106
|
+
|
|
107
|
+
_obj = cls.model_validate({
|
|
108
|
+
"rir": obj.get("rir"),
|
|
109
|
+
"asn": Asn.from_dict(obj["asn"]) if obj.get("asn") is not None else None,
|
|
110
|
+
"organization": Organization.from_dict(obj["organization"]) if obj.get("organization") is not None else None,
|
|
111
|
+
"abuseContact": AbuseContact.from_dict(obj["abuseContact"]) if obj.get("abuseContact") is not None else None,
|
|
112
|
+
"adminContact": AdminContact.from_dict(obj["adminContact"]) if obj.get("adminContact") is not None else None,
|
|
113
|
+
"techContact": TechContact.from_dict(obj["techContact"]) if obj.get("techContact") is not None else None
|
|
114
|
+
})
|
|
115
|
+
return _obj
|
|
116
|
+
|
|
117
|
+
|
|
File without changes
|
|
@@ -0,0 +1,257 @@
|
|
|
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
|
+
|
|
15
|
+
import io
|
|
16
|
+
import json
|
|
17
|
+
import re
|
|
18
|
+
import ssl
|
|
19
|
+
|
|
20
|
+
import urllib3
|
|
21
|
+
|
|
22
|
+
from openapi_client.exceptions import ApiException, ApiValueError
|
|
23
|
+
|
|
24
|
+
SUPPORTED_SOCKS_PROXIES = {"socks5", "socks5h", "socks4", "socks4a"}
|
|
25
|
+
RESTResponseType = urllib3.HTTPResponse
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def is_socks_proxy_url(url):
|
|
29
|
+
if url is None:
|
|
30
|
+
return False
|
|
31
|
+
split_section = url.split("://")
|
|
32
|
+
if len(split_section) < 2:
|
|
33
|
+
return False
|
|
34
|
+
else:
|
|
35
|
+
return split_section[0].lower() in SUPPORTED_SOCKS_PROXIES
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
class RESTResponse(io.IOBase):
|
|
39
|
+
|
|
40
|
+
def __init__(self, resp) -> None:
|
|
41
|
+
self.response = resp
|
|
42
|
+
self.status = resp.status
|
|
43
|
+
self.reason = resp.reason
|
|
44
|
+
self.data = None
|
|
45
|
+
|
|
46
|
+
def read(self):
|
|
47
|
+
if self.data is None:
|
|
48
|
+
self.data = self.response.data
|
|
49
|
+
return self.data
|
|
50
|
+
|
|
51
|
+
def getheaders(self):
|
|
52
|
+
"""Returns a dictionary of the response headers."""
|
|
53
|
+
return self.response.headers
|
|
54
|
+
|
|
55
|
+
def getheader(self, name, default=None):
|
|
56
|
+
"""Returns a given response header."""
|
|
57
|
+
return self.response.headers.get(name, default)
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
class RESTClientObject:
|
|
61
|
+
|
|
62
|
+
def __init__(self, configuration) -> None:
|
|
63
|
+
# urllib3.PoolManager will pass all kw parameters to connectionpool
|
|
64
|
+
# https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/poolmanager.py#L75 # noqa: E501
|
|
65
|
+
# https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/connectionpool.py#L680 # noqa: E501
|
|
66
|
+
# Custom SSL certificates and client certificates: http://urllib3.readthedocs.io/en/latest/advanced-usage.html # noqa: E501
|
|
67
|
+
|
|
68
|
+
# cert_reqs
|
|
69
|
+
if configuration.verify_ssl:
|
|
70
|
+
cert_reqs = ssl.CERT_REQUIRED
|
|
71
|
+
else:
|
|
72
|
+
cert_reqs = ssl.CERT_NONE
|
|
73
|
+
|
|
74
|
+
pool_args = {
|
|
75
|
+
"cert_reqs": cert_reqs,
|
|
76
|
+
"ca_certs": configuration.ssl_ca_cert,
|
|
77
|
+
"cert_file": configuration.cert_file,
|
|
78
|
+
"key_file": configuration.key_file,
|
|
79
|
+
}
|
|
80
|
+
if configuration.assert_hostname is not None:
|
|
81
|
+
pool_args['assert_hostname'] = (
|
|
82
|
+
configuration.assert_hostname
|
|
83
|
+
)
|
|
84
|
+
|
|
85
|
+
if configuration.retries is not None:
|
|
86
|
+
pool_args['retries'] = configuration.retries
|
|
87
|
+
|
|
88
|
+
if configuration.tls_server_name:
|
|
89
|
+
pool_args['server_hostname'] = configuration.tls_server_name
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
if configuration.socket_options is not None:
|
|
93
|
+
pool_args['socket_options'] = configuration.socket_options
|
|
94
|
+
|
|
95
|
+
if configuration.connection_pool_maxsize is not None:
|
|
96
|
+
pool_args['maxsize'] = configuration.connection_pool_maxsize
|
|
97
|
+
|
|
98
|
+
# https pool manager
|
|
99
|
+
self.pool_manager: urllib3.PoolManager
|
|
100
|
+
|
|
101
|
+
if configuration.proxy:
|
|
102
|
+
if is_socks_proxy_url(configuration.proxy):
|
|
103
|
+
from urllib3.contrib.socks import SOCKSProxyManager
|
|
104
|
+
pool_args["proxy_url"] = configuration.proxy
|
|
105
|
+
pool_args["headers"] = configuration.proxy_headers
|
|
106
|
+
self.pool_manager = SOCKSProxyManager(**pool_args)
|
|
107
|
+
else:
|
|
108
|
+
pool_args["proxy_url"] = configuration.proxy
|
|
109
|
+
pool_args["proxy_headers"] = configuration.proxy_headers
|
|
110
|
+
self.pool_manager = urllib3.ProxyManager(**pool_args)
|
|
111
|
+
else:
|
|
112
|
+
self.pool_manager = urllib3.PoolManager(**pool_args)
|
|
113
|
+
|
|
114
|
+
def request(
|
|
115
|
+
self,
|
|
116
|
+
method,
|
|
117
|
+
url,
|
|
118
|
+
headers=None,
|
|
119
|
+
body=None,
|
|
120
|
+
post_params=None,
|
|
121
|
+
_request_timeout=None
|
|
122
|
+
):
|
|
123
|
+
"""Perform requests.
|
|
124
|
+
|
|
125
|
+
:param method: http request method
|
|
126
|
+
:param url: http request url
|
|
127
|
+
:param headers: http request headers
|
|
128
|
+
:param body: request json body, for `application/json`
|
|
129
|
+
:param post_params: request post parameters,
|
|
130
|
+
`application/x-www-form-urlencoded`
|
|
131
|
+
and `multipart/form-data`
|
|
132
|
+
:param _request_timeout: timeout setting for this request. If one
|
|
133
|
+
number provided, it will be total request
|
|
134
|
+
timeout. It can also be a pair (tuple) of
|
|
135
|
+
(connection, read) timeouts.
|
|
136
|
+
"""
|
|
137
|
+
method = method.upper()
|
|
138
|
+
assert method in [
|
|
139
|
+
'GET',
|
|
140
|
+
'HEAD',
|
|
141
|
+
'DELETE',
|
|
142
|
+
'POST',
|
|
143
|
+
'PUT',
|
|
144
|
+
'PATCH',
|
|
145
|
+
'OPTIONS'
|
|
146
|
+
]
|
|
147
|
+
|
|
148
|
+
if post_params and body:
|
|
149
|
+
raise ApiValueError(
|
|
150
|
+
"body parameter cannot be used with post_params parameter."
|
|
151
|
+
)
|
|
152
|
+
|
|
153
|
+
post_params = post_params or {}
|
|
154
|
+
headers = headers or {}
|
|
155
|
+
|
|
156
|
+
timeout = None
|
|
157
|
+
if _request_timeout:
|
|
158
|
+
if isinstance(_request_timeout, (int, float)):
|
|
159
|
+
timeout = urllib3.Timeout(total=_request_timeout)
|
|
160
|
+
elif (
|
|
161
|
+
isinstance(_request_timeout, tuple)
|
|
162
|
+
and len(_request_timeout) == 2
|
|
163
|
+
):
|
|
164
|
+
timeout = urllib3.Timeout(
|
|
165
|
+
connect=_request_timeout[0],
|
|
166
|
+
read=_request_timeout[1]
|
|
167
|
+
)
|
|
168
|
+
|
|
169
|
+
try:
|
|
170
|
+
# For `POST`, `PUT`, `PATCH`, `OPTIONS`, `DELETE`
|
|
171
|
+
if method in ['POST', 'PUT', 'PATCH', 'OPTIONS', 'DELETE']:
|
|
172
|
+
|
|
173
|
+
# no content type provided or payload is json
|
|
174
|
+
content_type = headers.get('Content-Type')
|
|
175
|
+
if (
|
|
176
|
+
not content_type
|
|
177
|
+
or re.search('json', content_type, re.IGNORECASE)
|
|
178
|
+
):
|
|
179
|
+
request_body = None
|
|
180
|
+
if body is not None:
|
|
181
|
+
request_body = json.dumps(body)
|
|
182
|
+
r = self.pool_manager.request(
|
|
183
|
+
method,
|
|
184
|
+
url,
|
|
185
|
+
body=request_body,
|
|
186
|
+
timeout=timeout,
|
|
187
|
+
headers=headers,
|
|
188
|
+
preload_content=False
|
|
189
|
+
)
|
|
190
|
+
elif content_type == 'application/x-www-form-urlencoded':
|
|
191
|
+
r = self.pool_manager.request(
|
|
192
|
+
method,
|
|
193
|
+
url,
|
|
194
|
+
fields=post_params,
|
|
195
|
+
encode_multipart=False,
|
|
196
|
+
timeout=timeout,
|
|
197
|
+
headers=headers,
|
|
198
|
+
preload_content=False
|
|
199
|
+
)
|
|
200
|
+
elif content_type == 'multipart/form-data':
|
|
201
|
+
# must del headers['Content-Type'], or the correct
|
|
202
|
+
# Content-Type which generated by urllib3 will be
|
|
203
|
+
# overwritten.
|
|
204
|
+
del headers['Content-Type']
|
|
205
|
+
# Ensures that dict objects are serialized
|
|
206
|
+
post_params = [(a, json.dumps(b)) if isinstance(b, dict) else (a,b) for a, b in post_params]
|
|
207
|
+
r = self.pool_manager.request(
|
|
208
|
+
method,
|
|
209
|
+
url,
|
|
210
|
+
fields=post_params,
|
|
211
|
+
encode_multipart=True,
|
|
212
|
+
timeout=timeout,
|
|
213
|
+
headers=headers,
|
|
214
|
+
preload_content=False
|
|
215
|
+
)
|
|
216
|
+
# Pass a `string` parameter directly in the body to support
|
|
217
|
+
# other content types than JSON when `body` argument is
|
|
218
|
+
# provided in serialized form.
|
|
219
|
+
elif isinstance(body, str) or isinstance(body, bytes):
|
|
220
|
+
r = self.pool_manager.request(
|
|
221
|
+
method,
|
|
222
|
+
url,
|
|
223
|
+
body=body,
|
|
224
|
+
timeout=timeout,
|
|
225
|
+
headers=headers,
|
|
226
|
+
preload_content=False
|
|
227
|
+
)
|
|
228
|
+
elif headers['Content-Type'].startswith('text/') and isinstance(body, bool):
|
|
229
|
+
request_body = "true" if body else "false"
|
|
230
|
+
r = self.pool_manager.request(
|
|
231
|
+
method,
|
|
232
|
+
url,
|
|
233
|
+
body=request_body,
|
|
234
|
+
preload_content=False,
|
|
235
|
+
timeout=timeout,
|
|
236
|
+
headers=headers)
|
|
237
|
+
else:
|
|
238
|
+
# Cannot generate the request from given parameters
|
|
239
|
+
msg = """Cannot prepare a request message for provided
|
|
240
|
+
arguments. Please check that your arguments match
|
|
241
|
+
declared content type."""
|
|
242
|
+
raise ApiException(status=0, reason=msg)
|
|
243
|
+
# For `GET`, `HEAD`
|
|
244
|
+
else:
|
|
245
|
+
r = self.pool_manager.request(
|
|
246
|
+
method,
|
|
247
|
+
url,
|
|
248
|
+
fields={},
|
|
249
|
+
timeout=timeout,
|
|
250
|
+
headers=headers,
|
|
251
|
+
preload_content=False
|
|
252
|
+
)
|
|
253
|
+
except urllib3.exceptions.SSLError as e:
|
|
254
|
+
msg = "\n".join([type(e).__name__, str(e)])
|
|
255
|
+
raise ApiException(status=0, reason=msg)
|
|
256
|
+
|
|
257
|
+
return RESTResponse(r)
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: opportify_sdk
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Opportify Insights API
|
|
5
|
+
Home-page: https://github.com/opportify/opportify-sdk-python
|
|
6
|
+
Author: Opportify & OpenAPI-Generator
|
|
7
|
+
Author-email:
|
|
8
|
+
Keywords: OpenAPI,OpenAPI-Generator,Opportify Insights API,Opportify
|
|
9
|
+
Description-Content-Type: text/markdown
|
|
10
|
+
Requires-Dist: urllib3<3.0.0,>=1.25.3
|
|
11
|
+
Requires-Dist: python-dateutil>=2.8.2
|
|
12
|
+
Requires-Dist: pydantic>=2
|
|
13
|
+
Requires-Dist: typing-extensions>=4.7.1
|
|
14
|
+
|
|
15
|
+
## 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.
|
|
16
|
+
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
lib/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
+
lib/v1/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
|
+
lib/v1/openapi_client/__init__.py,sha256=4YbyZsJjF4Ig1mWXt6fxS7uhdr0uDEQPZQ-xsbDIwDI,5986
|
|
4
|
+
lib/v1/openapi_client/api_client.py,sha256=v_S3upItmHMMZXNSWYBtFIy2SSjt_MLAOcXpMiBST8g,30433
|
|
5
|
+
lib/v1/openapi_client/api_response.py,sha256=eMxw1mpmJcoGZ3gs9z6jM4oYoZ10Gjk333s9sKxGv7s,652
|
|
6
|
+
lib/v1/openapi_client/configuration.py,sha256=8U7Zd4rziMXTXvviDquxlSdDgSuSmsttGYeGDNOkod0,21544
|
|
7
|
+
lib/v1/openapi_client/exceptions.py,sha256=tHCC6Ij9c8ScVmZyCL5thgYXpopuUG1NSpILlHI_-Sg,8938
|
|
8
|
+
lib/v1/openapi_client/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
9
|
+
lib/v1/openapi_client/rest.py,sha256=QwKi4N39ZgYVtBPrXQzw8bkhpiZbfUUPuWhi44tMst0,12378
|
|
10
|
+
lib/v1/openapi_client/api/__init__.py,sha256=_2MpmNT7so7K9CyzP-_2Sd_1EU8-Gq10jtUKccY86-Q,176
|
|
11
|
+
lib/v1/openapi_client/api/email_insights_api.py,sha256=bbstLmF0CoBah5qxImN--ic1lBD1uMZ7jr0-ZpWUoAc,20667
|
|
12
|
+
lib/v1/openapi_client/api/ip_insights_api.py,sha256=oCmkRBxVMaVBzrBsA6BoumRl7PvhlyMJla-xYPHMxww,21817
|
|
13
|
+
lib/v1/openapi_client/models/__init__.py,sha256=9VT3hqjFqoCePDx2FhQ2qHjG4dIUbzc8VkBWgsrPtyc,5314
|
|
14
|
+
lib/v1/openapi_client/models/abuse_contact.py,sha256=MqF8oUU6hxU4vLXlC6ykcpJiZhjRw6EiJDfeDWYCBxQ,6560
|
|
15
|
+
lib/v1/openapi_client/models/admin_contact.py,sha256=HOmd_CnYyKtOPR-mGL3hbMZ8E5_TKlBlFgMVZOvfGH8,6560
|
|
16
|
+
lib/v1/openapi_client/models/analyze_email200_response.py,sha256=0YCuUfjKTB_J7FPCHeiPDG-bK5NMf-U-qFvGtQG6h-c,8043
|
|
17
|
+
lib/v1/openapi_client/models/analyze_email400_response.py,sha256=BrhikNZYFE0L1SScOlmZKh1CQNsOWi8m8e1fOzG9nus,5843
|
|
18
|
+
lib/v1/openapi_client/models/analyze_email400_response_error.py,sha256=oxfixZuiMnwbqRwdDzO7q4MKhQgVyFwxjOKdXpVLc_E,8391
|
|
19
|
+
lib/v1/openapi_client/models/analyze_email500_response.py,sha256=gAKw0QyVwBZdr52qCrSbRA8kdtBcIn-oW83hvK411j0,5843
|
|
20
|
+
lib/v1/openapi_client/models/analyze_email500_response_error.py,sha256=LuKvELP551F70uAKOnQ_0eVI9fK1V5RLdksgCMtTEwA,5615
|
|
21
|
+
lib/v1/openapi_client/models/analyze_email_request.py,sha256=yzu8AV6wBKWhbBUO7GtsCuKgX_KYJAg9c8bIWjMPJc4,6063
|
|
22
|
+
lib/v1/openapi_client/models/analyze_ip200_response.py,sha256=_8uU_YPLrwTc-Mth3keN7TlWkm7jCiIYi2i1UHzWySk,9143
|
|
23
|
+
lib/v1/openapi_client/models/analyze_ip400_response.py,sha256=aLPWgDU-QbKLzTD1KzHna3VURVRfqwP5m8WM4GINZPM,5819
|
|
24
|
+
lib/v1/openapi_client/models/analyze_ip400_response_error.py,sha256=X2wjsiTtaSWmC-zeKYgwtlQ-N_onhB3Fv2pvFhsOWmg,8486
|
|
25
|
+
lib/v1/openapi_client/models/analyze_ip404_response.py,sha256=mzS98l1DlVKFCFaOmhBc9XjUA7DdGJSXDBmFuL8Yjyk,5748
|
|
26
|
+
lib/v1/openapi_client/models/analyze_ip500_response.py,sha256=FPgWlfRyaFWGNk4xmh6UBiG_Xiys-i7IMZOWu2HoCY8,5768
|
|
27
|
+
lib/v1/openapi_client/models/analyze_ip_request.py,sha256=SZHr8Gd0mRrziip0VH5bgPZu84JCXGKjTSOzO8iSczc,5741
|
|
28
|
+
lib/v1/openapi_client/models/asn.py,sha256=_PtsmGJCAogM2DryLp5SuIgKZ_5H4zkLQvBcYV8-F90,6237
|
|
29
|
+
lib/v1/openapi_client/models/block_listed.py,sha256=UK0LxB8cPQzr6RP18p1GfLiLyVNJqPdYYrJyuhQiwdU,6815
|
|
30
|
+
lib/v1/openapi_client/models/email_dns.py,sha256=0Ttu0-pEQke0lnwkA4Tq8ZKvED6nRn6abSGkPqVEa24,5546
|
|
31
|
+
lib/v1/openapi_client/models/geo.py,sha256=GtTV2s0pDguxBBCbkViNidTmFmRsxfMqMwbb0IWnYkQ,9879
|
|
32
|
+
lib/v1/openapi_client/models/internalerror.py,sha256=_LhOiY2kPKsN_WDU7tVuY65A9-mNiamedWqJddWKRZQ,5555
|
|
33
|
+
lib/v1/openapi_client/models/invalidemail.py,sha256=-ofiTmHw2O61p_hzzELf_wpa9zgi5FjV_Kc-duJFY-o,5551
|
|
34
|
+
lib/v1/openapi_client/models/ipvalidationfailed.py,sha256=Clmw3EqB48h6mfhUzNnWvgO5IzfLq03pMbtWfzxD8xo,5575
|
|
35
|
+
lib/v1/openapi_client/models/malformedrequest.py,sha256=gaOr0Bh_d_Fy0gstnQzurGUD6JAF_kk2fi7Y7PnitB0,5567
|
|
36
|
+
lib/v1/openapi_client/models/malformedrequest1.py,sha256=PZ1e26zin5yhpjwnsuht8XNIHweURLb3n1NwR8rTvV8,5571
|
|
37
|
+
lib/v1/openapi_client/models/notfound.py,sha256=HifW-VdCOp0mn5RQdeM6QVQR1kZc5PlENAik0b9SGDo,5535
|
|
38
|
+
lib/v1/openapi_client/models/organization.py,sha256=IcJr7vJXyKwE9VjlWwJh1PeRar3_gQ4sNkvniMSLQzk,7130
|
|
39
|
+
lib/v1/openapi_client/models/risk_report.py,sha256=ANg1NOURvS-2mXbU8lNHgAlTNuNUYw4NkF43TR5ujsc,9132
|
|
40
|
+
lib/v1/openapi_client/models/tech_contact.py,sha256=AF9myIFacYEMknGN_gGrqjRn8_mpiI7Y_fGhp1wHWpE,6549
|
|
41
|
+
lib/v1/openapi_client/models/trusted_provider.py,sha256=DI33v3eTc6fUhx5NqbjOE7ZpA2VcKbNLSV5MWqodGB0,6174
|
|
42
|
+
lib/v1/openapi_client/models/whois.py,sha256=Yoo9QsUHPMjo9nwSR_H8ZHMhP2fYNRug3jBk3Do6vcw,8833
|
|
43
|
+
src/__init__.py,sha256=b5dO5TZ0ac8L7meGstmpAzIWXS9jwPqV1EruY32dffk,139
|
|
44
|
+
src/email_insights.py,sha256=i4NaYLZiJfXeHaNRZz3V15q8nsgGMcC37iBG5AaDj-Q,3283
|
|
45
|
+
src/ip_insights.py,sha256=yaydXslmi5e_cSFCniJTFCWazE1Zw4K-ZlXiLxGbfkU,3008
|
|
46
|
+
opportify_sdk-0.1.0.dist-info/METADATA,sha256=u63zsg5SzWamAFAVQnmywviy90LXju2_ABnbeBT1hrU,3661
|
|
47
|
+
opportify_sdk-0.1.0.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
|
|
48
|
+
opportify_sdk-0.1.0.dist-info/top_level.txt,sha256=4zVviOxxwoucHwO4Z7OzyNBMPn7vZjaTdyfvDO-OZfg,8
|
|
49
|
+
opportify_sdk-0.1.0.dist-info/RECORD,,
|