Skip to content

Commit 3384030

Browse files
Add files via upload
1 parent ffab633 commit 3384030

18 files changed

+968
-0
lines changed

arachnid_shield_sdk/__init__.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
""" A client library for accessing Arachnid Shield Public API """
2+
from .api.v1 import ArachnidShield, ArachnidShieldAsync
3+
from .models import (
4+
ArachnidShieldException,
5+
ErrorDetail,
6+
ScanMediaFromUrl,
7+
ScanMediaFromBytes,
8+
ScannedMedia,
9+
VisualMatchDetails,
10+
Media,
11+
MediaClassification,
12+
MatchDetails, PDQMatch, ScannedPDQHashes, ScanMediaFromPdq,
13+
)
14+
from .models.scanned_media import NearMatchDetail, MatchType
15+
16+
__all__ = (
17+
"ArachnidShield",
18+
"ArachnidShieldAsync",
19+
"ArachnidShieldException",
20+
"ErrorDetail",
21+
"ScanMediaFromUrl",
22+
"ScanMediaFromBytes",
23+
"ScannedMedia",
24+
"VisualMatchDetails",
25+
"Media",
26+
"MediaClassification",
27+
"MatchDetails",
28+
"NearMatchDetail",
29+
"ScannedPDQHashes",
30+
"PDQMatch",
31+
"ScanMediaFromPdq",
32+
"MatchType"
33+
)
34+

arachnid_shield_sdk/api/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
__all__ = ("v1",)
Binary file not shown.
Binary file not shown.
Binary file not shown.

arachnid_shield_sdk/api/client.py

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import typing
2+
import os
3+
import httpx
4+
5+
6+
DEFAULT_BASE_URL = "https://shield.projectarachnid.com/"
7+
8+
9+
class _ArachnidShield:
10+
__base_url: str
11+
__username: typing.Union[str, bytes]
12+
__password: typing.Union[str, bytes]
13+
14+
def __init__(
15+
self,
16+
*,
17+
username: typing.Union[str, bytes],
18+
password: typing.Union[str, bytes],
19+
base_url: str = os.getenv("ARACHNID_SHIELD_URL", DEFAULT_BASE_URL),
20+
):
21+
self.__base_url = base_url
22+
self.__username = username
23+
self.__password = password
24+
25+
def _build_sync_http_client(self):
26+
return httpx.Client(auth=httpx.BasicAuth(username=self.__username, password=self.__password))
27+
28+
def _build_async_http_client(self):
29+
return httpx.AsyncClient(auth=httpx.BasicAuth(username=self.__username, password=self.__password))
30+
31+
@property
32+
def base_url(self):
33+
return self.__base_url

0 commit comments

Comments
 (0)