kyb-api-toolkit 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.
@@ -0,0 +1,60 @@
1
+ Metadata-Version: 2.4
2
+ Name: kyb-api-toolkit
3
+ Version: 0.1.0
4
+ Summary: One-line Python client for sanctions screening, EU VAT/LEI validation and UK company KYB APIs (RapidAPI).
5
+ License: MIT
6
+ Project-URL: Homepage, https://github.com/kyb-api-toolkit/sanctions-screening-api-examples
7
+ Project-URL: Sanctions, https://github.com/kyb-api-toolkit/sanctions-screening-api-examples
8
+ Project-URL: VAT-LEI, https://github.com/kyb-api-toolkit/eu-vat-lei-validator-examples
9
+ Project-URL: UK-KYB, https://github.com/kyb-api-toolkit/uk-company-kyb-api-examples
10
+ Keywords: kyb,kyc,sanctions,ofac,vat,vies,lei,companies-house,compliance,aml
11
+ Classifier: License :: OSI Approved :: MIT License
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Topic :: Office/Business :: Financial
14
+ Requires-Python: >=3.8
15
+ Description-Content-Type: text/markdown
16
+ License-File: LICENSE
17
+ Requires-Dist: requests>=2.20
18
+ Dynamic: license-file
19
+
20
+ # kyb-api-toolkit
21
+
22
+ One-line Python access to three KYB and compliance APIs hosted on RapidAPI:
23
+
24
+ - Sanctions Screening (OFAC, UN, EU lists)
25
+ - EU VAT and LEI validation
26
+ - UK company KYB (Companies House data)
27
+
28
+ You need a RapidAPI key with a subscription to each API you call. Each API has a free tier on RapidAPI.
29
+
30
+ ```
31
+ pip install kyb-api-toolkit
32
+ export RAPIDAPI_KEY=your-key
33
+ ```
34
+
35
+ ```python
36
+ from kyb_toolkit import Client
37
+
38
+ kyb = Client() # reads RAPIDAPI_KEY
39
+
40
+ kyb.sanctions.search("Vladimir Putin")
41
+ kyb.sanctions.batch(["Vladimir Putin", "Jane Smith"])
42
+
43
+ kyb.vat.validate("FR40303265045")
44
+ kyb.vat.lei("HWUPKR0MPOU8FGXBT394")
45
+ kyb.vat.lei_search("siemens", country="DE")
46
+
47
+ kyb.uk.search("tesco")
48
+ kyb.uk.kyb("00445790")
49
+ ```
50
+
51
+ Errors raise `kyb_toolkit.KybError`.
52
+
53
+ ## Links
54
+
55
+ - Sanctions repo: https://github.com/kyb-api-toolkit/sanctions-screening-api-examples
56
+ - VAT/LEI repo: https://github.com/kyb-api-toolkit/eu-vat-lei-validator-examples
57
+ - UK KYB repo: https://github.com/kyb-api-toolkit/uk-company-kyb-api-examples
58
+ - Tutorials: https://dev.to/kybapitoolkit
59
+
60
+ Results are informational and not legal or compliance advice.
@@ -0,0 +1,6 @@
1
+ kyb_api_toolkit-0.1.0.dist-info/licenses/LICENSE,sha256=cjgHmK9h1hMSh7DdPI3FNFU132QQAv7OOgLX7xCcX44,1069
2
+ kyb_toolkit/__init__.py,sha256=TRYGw9lay55B3lqDW0IF5GkXSaO6rZ0fcRHzzK1k3LY,2878
3
+ kyb_api_toolkit-0.1.0.dist-info/METADATA,sha256=je2KHdVAT2AR-lzvR831Ck-bJ2x7ZVZp94GqnzRIrHs,2022
4
+ kyb_api_toolkit-0.1.0.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
5
+ kyb_api_toolkit-0.1.0.dist-info/top_level.txt,sha256=Pevjv8lqel4xkldFTZNQRveflNluSVaENZRlTJys67c,12
6
+ kyb_api_toolkit-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (84.2.1)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1 @@
1
+ kyb_toolkit
@@ -0,0 +1,97 @@
1
+ """kyb-api-toolkit: one-line Python access to three KYB/compliance APIs on RapidAPI.
2
+
3
+ from kyb_toolkit import Client
4
+ kyb = Client() # reads RAPIDAPI_KEY from the environment
5
+ kyb.sanctions.search("Vladimir Putin")
6
+ kyb.vat.validate("FR40303265045")
7
+ kyb.uk.kyb("00445790")
8
+ """
9
+ import os
10
+
11
+ import requests
12
+
13
+ __version__ = "0.1.0"
14
+ __all__ = ["Client", "KybError"]
15
+
16
+ HOSTS = {
17
+ "sanctions": "sanctions-screening-api4.p.rapidapi.com",
18
+ "vat": "eu-vat-and-lei-validator.p.rapidapi.com",
19
+ "uk": "uk-company-kyb-api.p.rapidapi.com",
20
+ }
21
+
22
+
23
+ class KybError(Exception):
24
+ """Raised when an API call fails."""
25
+
26
+
27
+ class _Api:
28
+ def __init__(self, key, host, timeout):
29
+ self._host = host
30
+ self._timeout = timeout
31
+ self._headers = {"x-rapidapi-host": host, "x-rapidapi-key": key}
32
+
33
+ def _call(self, method, path, **kw):
34
+ try:
35
+ r = requests.request(
36
+ method, f"https://{self._host}{path}",
37
+ headers=self._headers, timeout=self._timeout, **kw)
38
+ r.raise_for_status()
39
+ return r.json()
40
+ except requests.RequestException as e:
41
+ raise KybError(str(e)) from e
42
+
43
+ def _get(self, path, **params):
44
+ params = {k: v for k, v in params.items() if v is not None}
45
+ return self._call("GET", path, params=params)
46
+
47
+ def _post(self, path, body):
48
+ return self._call("POST", path, json=body)
49
+
50
+
51
+ class Sanctions(_Api):
52
+ """OFAC / UN / EU sanctions list screening."""
53
+
54
+ def search(self, name, limit=5):
55
+ return self._get("/search", name=name, limit=limit)
56
+
57
+ def batch(self, names, limit=3):
58
+ return self._post("/batch", {"names": list(names), "limit": limit})
59
+
60
+
61
+ class Vat(_Api):
62
+ """EU VAT number and LEI code validation."""
63
+
64
+ def validate(self, number):
65
+ return self._get("/vat/validate", number=number)
66
+
67
+ def batch(self, numbers):
68
+ return self._post("/vat/batch", {"numbers": list(numbers)})
69
+
70
+ def lei(self, code):
71
+ return self._get("/lei/validate", lei=code)
72
+
73
+ def lei_search(self, q, limit=5, country=None):
74
+ return self._get("/lei/search", q=q, limit=limit, country=country)
75
+
76
+
77
+ class Uk(_Api):
78
+ """UK company (Companies House) KYB checks."""
79
+
80
+ def search(self, q, limit=5):
81
+ return self._get("/search", q=q, limit=limit)
82
+
83
+ def company(self, number):
84
+ return self._get(f"/company/{number}")
85
+
86
+ def kyb(self, number):
87
+ return self._get(f"/company/{number}/kyb")
88
+
89
+
90
+ class Client:
91
+ def __init__(self, api_key=None, timeout=30):
92
+ key = api_key or os.environ.get("RAPIDAPI_KEY")
93
+ if not key:
94
+ raise KybError("Pass api_key or set RAPIDAPI_KEY (your RapidAPI key).")
95
+ self.sanctions = Sanctions(key, HOSTS["sanctions"], timeout)
96
+ self.vat = Vat(key, HOSTS["vat"], timeout)
97
+ self.uk = Uk(key, HOSTS["uk"], timeout)