pyapiary 2.0.0__tar.gz → 2.0.2__tar.gz
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.
- {pyapiary-2.0.0 → pyapiary-2.0.2}/PKG-INFO +1 -1
- {pyapiary-2.0.0 → pyapiary-2.0.2}/pyproject.toml +1 -1
- {pyapiary-2.0.0 → pyapiary-2.0.2}/src/pyapiary/api_connectors/ipqs.py +8 -11
- {pyapiary-2.0.0 → pyapiary-2.0.2}/src/pyapiary/tests/test_ipqs/cassettes/test_ipqs_malicious_url_vcr.yaml +2 -2
- {pyapiary-2.0.0 → pyapiary-2.0.2}/src/pyapiary/tests/test_ipqs/test_unit_async_ipqs.py +5 -5
- {pyapiary-2.0.0 → pyapiary-2.0.2}/src/pyapiary/tests/test_ipqs/test_unit_ipqs.py +7 -4
- {pyapiary-2.0.0 → pyapiary-2.0.2}/README.md +0 -0
- {pyapiary-2.0.0 → pyapiary-2.0.2}/src/pyapiary/__init__.py +0 -0
- {pyapiary-2.0.0 → pyapiary-2.0.2}/src/pyapiary/api_connectors/__init__.py +0 -0
- {pyapiary-2.0.0 → pyapiary-2.0.2}/src/pyapiary/api_connectors/broker.py +0 -0
- {pyapiary-2.0.0 → pyapiary-2.0.2}/src/pyapiary/api_connectors/flashpoint.py +0 -0
- {pyapiary-2.0.0 → pyapiary-2.0.2}/src/pyapiary/api_connectors/generic.py +0 -0
- {pyapiary-2.0.0 → pyapiary-2.0.2}/src/pyapiary/api_connectors/spycloud.py +0 -0
- {pyapiary-2.0.0 → pyapiary-2.0.2}/src/pyapiary/api_connectors/twilio.py +0 -0
- {pyapiary-2.0.0 → pyapiary-2.0.2}/src/pyapiary/api_connectors/urlscan.py +0 -0
- {pyapiary-2.0.0 → pyapiary-2.0.2}/src/pyapiary/dbms_connectors/__init__.py +0 -0
- {pyapiary-2.0.0 → pyapiary-2.0.2}/src/pyapiary/dbms_connectors/elasticsearch.py +0 -0
- {pyapiary-2.0.0 → pyapiary-2.0.2}/src/pyapiary/dbms_connectors/mongo.py +0 -0
- {pyapiary-2.0.0 → pyapiary-2.0.2}/src/pyapiary/dbms_connectors/mongo_async.py +0 -0
- {pyapiary-2.0.0 → pyapiary-2.0.2}/src/pyapiary/dbms_connectors/odbc.py +0 -0
- {pyapiary-2.0.0 → pyapiary-2.0.2}/src/pyapiary/dbms_connectors/splunk.py +0 -0
- {pyapiary-2.0.0 → pyapiary-2.0.2}/src/pyapiary/helpers.py +0 -0
- {pyapiary-2.0.0 → pyapiary-2.0.2}/src/pyapiary/tests/__init__.py +0 -0
- {pyapiary-2.0.0 → pyapiary-2.0.2}/src/pyapiary/tests/conftest.py +0 -0
- {pyapiary-2.0.0 → pyapiary-2.0.2}/src/pyapiary/tests/test_broker/test_integration_broker.py +0 -0
- {pyapiary-2.0.0 → pyapiary-2.0.2}/src/pyapiary/tests/test_broker/test_unit_asyncbroker.py +0 -0
- {pyapiary-2.0.0 → pyapiary-2.0.2}/src/pyapiary/tests/test_broker/test_unit_broker.py +0 -0
- {pyapiary-2.0.0 → pyapiary-2.0.2}/src/pyapiary/tests/test_elasticsearch/test_unit_elasticsearch.py +0 -0
- {pyapiary-2.0.0 → pyapiary-2.0.2}/src/pyapiary/tests/test_flashpoint/cassettes/test_flashpoint_search_fraud_vcr.yaml +0 -0
- {pyapiary-2.0.0 → pyapiary-2.0.2}/src/pyapiary/tests/test_flashpoint/test_integration_flashpoint.py +0 -0
- {pyapiary-2.0.0 → pyapiary-2.0.2}/src/pyapiary/tests/test_flashpoint/test_unit_async_flashpoint.py +0 -0
- {pyapiary-2.0.0 → pyapiary-2.0.2}/src/pyapiary/tests/test_flashpoint/test_unit_flashpoint.py +0 -0
- {pyapiary-2.0.0 → pyapiary-2.0.2}/src/pyapiary/tests/test_generic/cassettes/test_generic_get_github_api.yaml +0 -0
- {pyapiary-2.0.0 → pyapiary-2.0.2}/src/pyapiary/tests/test_generic/test_integration_generic_connector.py +0 -0
- {pyapiary-2.0.0 → pyapiary-2.0.2}/src/pyapiary/tests/test_generic/test_unit_async_generic_connector.py +0 -0
- {pyapiary-2.0.0 → pyapiary-2.0.2}/src/pyapiary/tests/test_generic/test_unit_generic_connector.py +0 -0
- {pyapiary-2.0.0 → pyapiary-2.0.2}/src/pyapiary/tests/test_ipqs/__init__.py +0 -0
- {pyapiary-2.0.0 → pyapiary-2.0.2}/src/pyapiary/tests/test_ipqs/test_integration_ipqs.py +0 -0
- {pyapiary-2.0.0 → pyapiary-2.0.2}/src/pyapiary/tests/test_mongodb/test_unit_async_mongo.py +0 -0
- {pyapiary-2.0.0 → pyapiary-2.0.2}/src/pyapiary/tests/test_mongodb/test_unit_mongo.py +0 -0
- {pyapiary-2.0.0 → pyapiary-2.0.2}/src/pyapiary/tests/test_odbc/test_unit_odbc.py +0 -0
- {pyapiary-2.0.0 → pyapiary-2.0.2}/src/pyapiary/tests/test_splunk/test_unit_splunk.py +0 -0
- {pyapiary-2.0.0 → pyapiary-2.0.2}/src/pyapiary/tests/test_spycloud/cassettes/test_spycloud_ato_search_vcr.yaml +0 -0
- {pyapiary-2.0.0 → pyapiary-2.0.2}/src/pyapiary/tests/test_spycloud/test_integration_spycloud.py +0 -0
- {pyapiary-2.0.0 → pyapiary-2.0.2}/src/pyapiary/tests/test_spycloud/test_unit_async_spycloud.py +0 -0
- {pyapiary-2.0.0 → pyapiary-2.0.2}/src/pyapiary/tests/test_spycloud/test_unit_spycloud.py +0 -0
- {pyapiary-2.0.0 → pyapiary-2.0.2}/src/pyapiary/tests/test_twilio/cassettes/test_lookup_phone_vcr.yaml +0 -0
- {pyapiary-2.0.0 → pyapiary-2.0.2}/src/pyapiary/tests/test_twilio/test_integration_twilio.py +0 -0
- {pyapiary-2.0.0 → pyapiary-2.0.2}/src/pyapiary/tests/test_twilio/test_unit_async_twilio.py +0 -0
- {pyapiary-2.0.0 → pyapiary-2.0.2}/src/pyapiary/tests/test_twilio/test_unit_twilio.py +0 -0
- {pyapiary-2.0.0 → pyapiary-2.0.2}/src/pyapiary/tests/test_urlscan/cassettes/test_urlscan_results_vcr.yaml +0 -0
- {pyapiary-2.0.0 → pyapiary-2.0.2}/src/pyapiary/tests/test_urlscan/test_integration_urlscan.py +0 -0
- {pyapiary-2.0.0 → pyapiary-2.0.2}/src/pyapiary/tests/test_urlscan/test_unit_async_urlscan.py +0 -0
- {pyapiary-2.0.0 → pyapiary-2.0.2}/src/pyapiary/tests/test_urlscan/test_unit_urlscan.py +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "pyapiary"
|
|
3
3
|
packages = [{ include = "pyapiary", from = "src" }]
|
|
4
|
-
version = "2.0.
|
|
4
|
+
version = "2.0.2"
|
|
5
5
|
description = "A simple, lightweight set of connectors and functions to various APIs and DBMSs, controlled by a central broker."
|
|
6
6
|
authors = ["Rob D'Aveta <rob.daveta@gmail.com>"]
|
|
7
7
|
readme = "README.md"
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import httpx
|
|
2
2
|
from typing import Optional
|
|
3
|
-
from urllib.parse import quote
|
|
4
3
|
from pyapiary.api_connectors.broker import Broker, AsyncBroker, bubble_broker_init_signature, log_method_call
|
|
5
4
|
|
|
6
5
|
@bubble_broker_init_signature()
|
|
@@ -16,12 +15,12 @@ class IPQSConnector(Broker):
|
|
|
16
15
|
api_key (str): The API key used to authenticate with IPQS.
|
|
17
16
|
"""
|
|
18
17
|
def __init__(self, api_key: Optional[str] = None, **kwargs):
|
|
19
|
-
super().__init__(base_url="https://ipqualityscore.com/api/json", **kwargs)
|
|
18
|
+
super().__init__(base_url="https://www.ipqualityscore.com/api/json", **kwargs)
|
|
20
19
|
|
|
21
20
|
self.api_key = api_key or self.env_config.get("IPQS_API_KEY")
|
|
22
21
|
if not self.api_key:
|
|
23
22
|
raise ValueError("API key is required for IPQSConnector")
|
|
24
|
-
self.headers.update({"Content-Type": "application/
|
|
23
|
+
self.headers.update({"Content-Type": "application/x-www-form-urlencoded"})
|
|
25
24
|
|
|
26
25
|
@log_method_call
|
|
27
26
|
def malicious_url(self, query: str, **kwargs) -> httpx.Response:
|
|
@@ -29,14 +28,13 @@ class IPQSConnector(Broker):
|
|
|
29
28
|
Scan a URL using IPQualityScore's Malicious URL Scanner API.
|
|
30
29
|
|
|
31
30
|
Args:
|
|
32
|
-
query (str): The URL to scan
|
|
31
|
+
query (str): The URL to scan.
|
|
33
32
|
**kwargs: Optional parameters like 'strictness' or 'fast' to influence scan behavior.
|
|
34
33
|
|
|
35
34
|
Returns:
|
|
36
35
|
httpx.Response: the httpx.Response object
|
|
37
36
|
"""
|
|
38
|
-
|
|
39
|
-
return self.post(f"/url/", json={"url": query, "key": self.api_key, **kwargs})
|
|
37
|
+
return self.post("/url/", data={"url": query, "key": self.api_key, **kwargs})
|
|
40
38
|
|
|
41
39
|
|
|
42
40
|
@bubble_broker_init_signature()
|
|
@@ -45,12 +43,12 @@ class AsyncIPQSConnector(AsyncBroker):
|
|
|
45
43
|
Async version of IPQSConnector using AsyncBroker infrastructure.
|
|
46
44
|
"""
|
|
47
45
|
def __init__(self, api_key: Optional[str] = None, **kwargs):
|
|
48
|
-
super().__init__(base_url="https://ipqualityscore.com/api/json", **kwargs)
|
|
46
|
+
super().__init__(base_url="https://www.ipqualityscore.com/api/json", **kwargs)
|
|
49
47
|
|
|
50
48
|
self.api_key = api_key or self.env_config.get("IPQS_API_KEY")
|
|
51
49
|
if not self.api_key:
|
|
52
50
|
raise ValueError("API key is required for AsyncIPQSConnector")
|
|
53
|
-
self.headers.update({"Content-Type": "application/
|
|
51
|
+
self.headers.update({"Content-Type": "application/x-www-form-urlencoded"})
|
|
54
52
|
|
|
55
53
|
@log_method_call
|
|
56
54
|
async def malicious_url(self, query: str, **kwargs) -> httpx.Response:
|
|
@@ -58,11 +56,10 @@ class AsyncIPQSConnector(AsyncBroker):
|
|
|
58
56
|
Asynchronously scan a URL using IPQualityScore's Malicious URL Scanner API.
|
|
59
57
|
|
|
60
58
|
Args:
|
|
61
|
-
query (str): The URL to scan
|
|
59
|
+
query (str): The URL to scan.
|
|
62
60
|
**kwargs: Optional parameters like 'strictness' or 'fast' to influence scan behavior.
|
|
63
61
|
|
|
64
62
|
Returns:
|
|
65
63
|
httpx.Response: the httpx.Response object
|
|
66
64
|
"""
|
|
67
|
-
|
|
68
|
-
return await self.post(f"/url/", json={"url": query, "key": self.api_key, **kwargs})
|
|
65
|
+
return await self.post("/url/", data={"url": query, "key": self.api_key, **kwargs})
|
|
@@ -13,11 +13,11 @@ interactions:
|
|
|
13
13
|
content-type:
|
|
14
14
|
- application/json
|
|
15
15
|
host:
|
|
16
|
-
- ipqualityscore.com
|
|
16
|
+
- www.ipqualityscore.com
|
|
17
17
|
user-agent:
|
|
18
18
|
- python-httpx/0.28.1
|
|
19
19
|
method: POST
|
|
20
|
-
uri: https://ipqualityscore.com/api/json/url/
|
|
20
|
+
uri: https://www.ipqualityscore.com/api/json/url/
|
|
21
21
|
response:
|
|
22
22
|
body:
|
|
23
23
|
string: !!binary |
|
|
@@ -8,7 +8,7 @@ from pyapiary.api_connectors.ipqs import AsyncIPQSConnector
|
|
|
8
8
|
async def test_async_init_with_api_key():
|
|
9
9
|
connector = AsyncIPQSConnector(api_key="test_key")
|
|
10
10
|
assert connector.api_key == "test_key"
|
|
11
|
-
assert connector.headers["Content-Type"] == "application/
|
|
11
|
+
assert connector.headers["Content-Type"] == "application/x-www-form-urlencoded"
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
@pytest.mark.asyncio
|
|
@@ -16,7 +16,7 @@ async def test_async_init_with_env_key():
|
|
|
16
16
|
with patch.dict("os.environ", {"IPQS_API_KEY": "env_key"}):
|
|
17
17
|
connector = AsyncIPQSConnector(load_env_vars=True)
|
|
18
18
|
assert connector.api_key == "env_key"
|
|
19
|
-
assert connector.headers["Content-Type"] == "application/
|
|
19
|
+
assert connector.headers["Content-Type"] == "application/x-www-form-urlencoded"
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
@pytest.mark.asyncio
|
|
@@ -31,7 +31,7 @@ async def test_async_init_missing_key():
|
|
|
31
31
|
async def test_async_malicious_url(mock_post):
|
|
32
32
|
import json
|
|
33
33
|
|
|
34
|
-
request = httpx.Request("POST", "https://ipqualityscore.com/api/json/url/")
|
|
34
|
+
request = httpx.Request("POST", "https://www.ipqualityscore.com/api/json/url/")
|
|
35
35
|
payload = {"success": True, "domain": "example.com"}
|
|
36
36
|
mock_response = httpx.Response(
|
|
37
37
|
200,
|
|
@@ -49,5 +49,5 @@ async def test_async_malicious_url(mock_post):
|
|
|
49
49
|
assert response.json() == payload
|
|
50
50
|
mock_post.assert_awaited_once_with(
|
|
51
51
|
"/url/",
|
|
52
|
-
|
|
53
|
-
)
|
|
52
|
+
data={"url": "example.com", "key": "test_key", "strictness": 1}
|
|
53
|
+
)
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import httpx
|
|
2
2
|
import pytest
|
|
3
|
-
from unittest.mock import patch
|
|
3
|
+
from unittest.mock import patch
|
|
4
4
|
from pyapiary.api_connectors.ipqs import IPQSConnector
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
def test_init_with_api_key():
|
|
8
8
|
connector = IPQSConnector(api_key="test_key")
|
|
9
9
|
assert connector.api_key == "test_key"
|
|
10
|
-
assert connector.headers["Content-Type"] == "application/
|
|
10
|
+
assert connector.headers["Content-Type"] == "application/x-www-form-urlencoded"
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
def test_init_with_env_key():
|
|
@@ -27,7 +27,7 @@ def test_malicious_url(mock_post):
|
|
|
27
27
|
# Build a real httpx.Response to match the new return type
|
|
28
28
|
import json
|
|
29
29
|
|
|
30
|
-
request = httpx.Request("POST", "https://ipqualityscore.com/api/json/url/")
|
|
30
|
+
request = httpx.Request("POST", "https://www.ipqualityscore.com/api/json/url/")
|
|
31
31
|
payload = {"success": True, "domain": "example.com"}
|
|
32
32
|
mock_response = httpx.Response(
|
|
33
33
|
200,
|
|
@@ -40,6 +40,9 @@ def test_malicious_url(mock_post):
|
|
|
40
40
|
connector = IPQSConnector(api_key="test_key")
|
|
41
41
|
result = connector.malicious_url("example.com")
|
|
42
42
|
|
|
43
|
-
mock_post.
|
|
43
|
+
mock_post.assert_called_once_with(
|
|
44
|
+
"/url/",
|
|
45
|
+
data={"url": "example.com", "key": "test_key"},
|
|
46
|
+
)
|
|
44
47
|
assert isinstance(result, httpx.Response)
|
|
45
48
|
assert result.json() == payload
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pyapiary-2.0.0 → pyapiary-2.0.2}/src/pyapiary/tests/test_elasticsearch/test_unit_elasticsearch.py
RENAMED
|
File without changes
|
|
File without changes
|
{pyapiary-2.0.0 → pyapiary-2.0.2}/src/pyapiary/tests/test_flashpoint/test_integration_flashpoint.py
RENAMED
|
File without changes
|
{pyapiary-2.0.0 → pyapiary-2.0.2}/src/pyapiary/tests/test_flashpoint/test_unit_async_flashpoint.py
RENAMED
|
File without changes
|
{pyapiary-2.0.0 → pyapiary-2.0.2}/src/pyapiary/tests/test_flashpoint/test_unit_flashpoint.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pyapiary-2.0.0 → pyapiary-2.0.2}/src/pyapiary/tests/test_generic/test_unit_generic_connector.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pyapiary-2.0.0 → pyapiary-2.0.2}/src/pyapiary/tests/test_spycloud/test_integration_spycloud.py
RENAMED
|
File without changes
|
{pyapiary-2.0.0 → pyapiary-2.0.2}/src/pyapiary/tests/test_spycloud/test_unit_async_spycloud.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pyapiary-2.0.0 → pyapiary-2.0.2}/src/pyapiary/tests/test_urlscan/test_integration_urlscan.py
RENAMED
|
File without changes
|
{pyapiary-2.0.0 → pyapiary-2.0.2}/src/pyapiary/tests/test_urlscan/test_unit_async_urlscan.py
RENAMED
|
File without changes
|
|
File without changes
|