veyaauth-sdk 1.0.0__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.
- veyaauth_sdk-1.0.0/PKG-INFO +26 -0
- veyaauth_sdk-1.0.0/README.md +3 -0
- veyaauth_sdk-1.0.0/setup.cfg +4 -0
- veyaauth_sdk-1.0.0/setup.py +22 -0
- veyaauth_sdk-1.0.0/veyaauth/__init__.py +106 -0
- veyaauth_sdk-1.0.0/veyaauth_sdk.egg-info/PKG-INFO +26 -0
- veyaauth_sdk-1.0.0/veyaauth_sdk.egg-info/SOURCES.txt +8 -0
- veyaauth_sdk-1.0.0/veyaauth_sdk.egg-info/dependency_links.txt +1 -0
- veyaauth_sdk-1.0.0/veyaauth_sdk.egg-info/requires.txt +1 -0
- veyaauth_sdk-1.0.0/veyaauth_sdk.egg-info/top_level.txt +1 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: veyaauth-sdk
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Official Python SDK for Veya verification API
|
|
5
|
+
Home-page: https://veya.kr
|
|
6
|
+
Author: Veya
|
|
7
|
+
Author-email: support@veya.kr
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
10
|
+
Classifier: Operating System :: OS Independent
|
|
11
|
+
Requires-Python: >=3.7
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
Requires-Dist: requests>=2.0.0
|
|
14
|
+
Dynamic: author
|
|
15
|
+
Dynamic: author-email
|
|
16
|
+
Dynamic: classifier
|
|
17
|
+
Dynamic: description
|
|
18
|
+
Dynamic: description-content-type
|
|
19
|
+
Dynamic: home-page
|
|
20
|
+
Dynamic: requires-dist
|
|
21
|
+
Dynamic: requires-python
|
|
22
|
+
Dynamic: summary
|
|
23
|
+
|
|
24
|
+
# README placeholder
|
|
25
|
+
# Veya Python SDK
|
|
26
|
+
Official Python SDK for the Veya API.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
from setuptools import setup, find_packages
|
|
2
|
+
|
|
3
|
+
setup(
|
|
4
|
+
name="veyaauth-sdk",
|
|
5
|
+
version="1.0.0",
|
|
6
|
+
description="Official Python SDK for Veya verification API",
|
|
7
|
+
long_description=open("README.md").read() if open("README.md", "r") else "",
|
|
8
|
+
long_description_content_type="text/markdown",
|
|
9
|
+
url="https://veya.kr",
|
|
10
|
+
author="Veya",
|
|
11
|
+
author_email="support@veya.kr",
|
|
12
|
+
packages=find_packages(),
|
|
13
|
+
install_requires=[
|
|
14
|
+
"requests>=2.0.0",
|
|
15
|
+
],
|
|
16
|
+
classifiers=[
|
|
17
|
+
"Programming Language :: Python :: 3",
|
|
18
|
+
"License :: OSI Approved :: MIT License",
|
|
19
|
+
"Operating System :: OS Independent",
|
|
20
|
+
],
|
|
21
|
+
python_requires=">=3.7",
|
|
22
|
+
)
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import requests
|
|
2
|
+
from typing import List, Dict, Any, Optional
|
|
3
|
+
|
|
4
|
+
class VeyaAPIError(Exception):
|
|
5
|
+
"""Exception raised for API errors"""
|
|
6
|
+
pass
|
|
7
|
+
|
|
8
|
+
class VerificationsClient:
|
|
9
|
+
def __init__(self, api_key: str, base_url: str):
|
|
10
|
+
self._api_key = api_key
|
|
11
|
+
self._base_url = base_url
|
|
12
|
+
|
|
13
|
+
def _request(self, method: str, endpoint: str, json: Optional[Dict] = None) -> Dict[str, Any]:
|
|
14
|
+
headers = {
|
|
15
|
+
"Content-Type": "application/json",
|
|
16
|
+
"X-API-Key": self._api_key
|
|
17
|
+
}
|
|
18
|
+
response = requests.request(
|
|
19
|
+
method=method,
|
|
20
|
+
url=f"{self._base_url}{endpoint}",
|
|
21
|
+
headers=headers,
|
|
22
|
+
json=json
|
|
23
|
+
)
|
|
24
|
+
if not response.ok:
|
|
25
|
+
try:
|
|
26
|
+
error_data = response.json()
|
|
27
|
+
msg = error_data.get("error") or error_data.get("message") or "Veya API Error"
|
|
28
|
+
except ValueError:
|
|
29
|
+
msg = f"Veya API Error: {response.status_code} {response.reason}"
|
|
30
|
+
raise VeyaAPIError(msg)
|
|
31
|
+
return response.json()
|
|
32
|
+
|
|
33
|
+
def create_link(
|
|
34
|
+
self,
|
|
35
|
+
social: Optional[List[str]] = None,
|
|
36
|
+
data_collection: Optional[List[str]] = None,
|
|
37
|
+
expires_in: int = 3600
|
|
38
|
+
) -> Dict[str, Any]:
|
|
39
|
+
"""
|
|
40
|
+
Create a one-time verification link.
|
|
41
|
+
"""
|
|
42
|
+
payload = {
|
|
43
|
+
"requirements": {
|
|
44
|
+
"social": social or [],
|
|
45
|
+
"dataCollection": data_collection or []
|
|
46
|
+
},
|
|
47
|
+
"expires_in": expires_in
|
|
48
|
+
}
|
|
49
|
+
return self._request("POST", "/verifications/link", json=payload)
|
|
50
|
+
|
|
51
|
+
def get_result(self, token: str) -> Dict[str, Any]:
|
|
52
|
+
"""
|
|
53
|
+
Retrieve the verification result using its token.
|
|
54
|
+
"""
|
|
55
|
+
return self._request("GET", f"/verifications/result/{token}")
|
|
56
|
+
|
|
57
|
+
class UsersClient:
|
|
58
|
+
def __init__(self, api_key: str, base_url: str):
|
|
59
|
+
self._api_key = api_key
|
|
60
|
+
self._base_url = base_url
|
|
61
|
+
|
|
62
|
+
def _request(self, method: str, endpoint: str, json: Optional[Dict] = None) -> Dict[str, Any]:
|
|
63
|
+
headers = {
|
|
64
|
+
"Content-Type": "application/json",
|
|
65
|
+
"X-API-Key": self._api_key
|
|
66
|
+
}
|
|
67
|
+
response = requests.request(
|
|
68
|
+
method=method,
|
|
69
|
+
url=f"{self._base_url}{endpoint}",
|
|
70
|
+
headers=headers,
|
|
71
|
+
json=json
|
|
72
|
+
)
|
|
73
|
+
if not response.ok:
|
|
74
|
+
try:
|
|
75
|
+
error_data = response.json()
|
|
76
|
+
msg = error_data.get("error") or error_data.get("message") or "Veya API Error"
|
|
77
|
+
except ValueError:
|
|
78
|
+
msg = f"Veya API Error: {response.status_code} {response.reason}"
|
|
79
|
+
raise VeyaAPIError(msg)
|
|
80
|
+
return response.json()
|
|
81
|
+
|
|
82
|
+
def search(self, query: str) -> Dict[str, Any]:
|
|
83
|
+
from urllib.parse import quote
|
|
84
|
+
return self._request("GET", f"/verifications/api/search?q={quote(query)}")
|
|
85
|
+
|
|
86
|
+
def remove(self, profile_id: str) -> Dict[str, Any]:
|
|
87
|
+
return self._request("DELETE", f"/verifications/api/user/{profile_id}")
|
|
88
|
+
|
|
89
|
+
def ban(self, profile_id: str, reason: str = "") -> Dict[str, Any]:
|
|
90
|
+
return self._request("POST", "/verifications/api/ban", json={"profile_id": profile_id, "reason": reason})
|
|
91
|
+
|
|
92
|
+
def unban(self, profile_id: str) -> Dict[str, Any]:
|
|
93
|
+
return self._request("DELETE", f"/verifications/api/ban/{profile_id}")
|
|
94
|
+
|
|
95
|
+
def list_bans(self) -> Dict[str, Any]:
|
|
96
|
+
return self._request("GET", "/verifications/api/bans")
|
|
97
|
+
|
|
98
|
+
class Veya:
|
|
99
|
+
def __init__(self, api_key: str, base_url: str = "https://api.veya.kr/v1"):
|
|
100
|
+
if not api_key:
|
|
101
|
+
raise ValueError("Veya API Key is required")
|
|
102
|
+
self.api_key = api_key
|
|
103
|
+
self.base_url = base_url
|
|
104
|
+
|
|
105
|
+
self.verifications = VerificationsClient(api_key, base_url)
|
|
106
|
+
self.users = UsersClient(api_key, base_url)
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: veyaauth-sdk
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Official Python SDK for Veya verification API
|
|
5
|
+
Home-page: https://veya.kr
|
|
6
|
+
Author: Veya
|
|
7
|
+
Author-email: support@veya.kr
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
10
|
+
Classifier: Operating System :: OS Independent
|
|
11
|
+
Requires-Python: >=3.7
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
Requires-Dist: requests>=2.0.0
|
|
14
|
+
Dynamic: author
|
|
15
|
+
Dynamic: author-email
|
|
16
|
+
Dynamic: classifier
|
|
17
|
+
Dynamic: description
|
|
18
|
+
Dynamic: description-content-type
|
|
19
|
+
Dynamic: home-page
|
|
20
|
+
Dynamic: requires-dist
|
|
21
|
+
Dynamic: requires-python
|
|
22
|
+
Dynamic: summary
|
|
23
|
+
|
|
24
|
+
# README placeholder
|
|
25
|
+
# Veya Python SDK
|
|
26
|
+
Official Python SDK for the Veya API.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
requests>=2.0.0
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
veyaauth
|