registryhound 0.1.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.
- registryhound-0.1.0/.gitignore +5 -0
- registryhound-0.1.0/LICENSE +21 -0
- registryhound-0.1.0/PKG-INFO +58 -0
- registryhound-0.1.0/README.md +41 -0
- registryhound-0.1.0/pyproject.toml +23 -0
- registryhound-0.1.0/registryhound/__init__.py +86 -0
- registryhound-0.1.0/registryhound/py.typed +0 -0
- registryhound-0.1.0/tests/test_client.py +39 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Opimus LLC
|
|
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,58 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: registryhound
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Zero-dependency client for RegistryHound: US federal public registries (FMCSA, FAA, SEC, NPI, OFAC, FDIC and more) with change detection
|
|
5
|
+
Project-URL: Homepage, https://registryhound.com
|
|
6
|
+
Project-URL: Documentation, https://registryhound.com/docs
|
|
7
|
+
Project-URL: Source, https://github.com/Baffles78/registryhound-clients
|
|
8
|
+
Author: Opimus LLC
|
|
9
|
+
License-Expression: MIT
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Keywords: edgar,faa,fdic,fmcsa,npi,ofac,public records,registryhound,sec,usdot,x402
|
|
12
|
+
Classifier: Operating System :: OS Independent
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Typing :: Typed
|
|
15
|
+
Requires-Python: >=3.9
|
|
16
|
+
Description-Content-Type: text/markdown
|
|
17
|
+
|
|
18
|
+
# RegistryHound clients
|
|
19
|
+
|
|
20
|
+
Zero-dependency JavaScript and Python clients for [RegistryHound](https://registryhound.com), which republishes US federal public registries with daily change detection: FMCSA motor carriers, FAA aircraft, SEC EDGAR companies, CMS NPI, OSHA inspections, USAspending awards, EPA ECHO, openFDA and NHTSA recalls, SAM.gov, FCC ULS, USPTO trademarks, FDIC banks, USDA organic operations, MSHA mines, OFAC sanctions, CFPB complaints and more.
|
|
21
|
+
|
|
22
|
+
| Package | Path | Install |
|
|
23
|
+
|---|---|---|
|
|
24
|
+
| JavaScript / TypeScript (Node 18+, browsers, Deno, Bun) | js | `npm install registryhound` |
|
|
25
|
+
| Python 3.9+ | python | `pip install registryhound` |
|
|
26
|
+
|
|
27
|
+
Free endpoints (search, per-record JSON and Markdown) need no key. The change-detection API (`/api/v1`: trigger feeds, entity API, cross-registry resolver, webhooks) takes an API key, or pays per request with [x402](https://registryhound.com/.well-known/x402.json). Docs: <https://registryhound.com/docs> · OpenAPI: <https://registryhound.com/openapi.json> · MCP server: [registryhound-mcp](https://github.com/Baffles78/registryhound-mcp).
|
|
28
|
+
|
|
29
|
+
## JavaScript
|
|
30
|
+
|
|
31
|
+
```js
|
|
32
|
+
import { RegistryHound } from 'registryhound';
|
|
33
|
+
|
|
34
|
+
const rh = new RegistryHound(); // apiKey from REGISTRYHOUND_API_KEY for paid calls
|
|
35
|
+
const { results } = await rh.search('walmart', { limit: 5 });
|
|
36
|
+
const apple = await rh.entity('sec', '320193'); // JSON, includes a ready-made `citation`
|
|
37
|
+
const dossier = await rh.markdown('fmcsa', '3405079'); // token-efficient Markdown for LLM context
|
|
38
|
+
const feed = await rh.triggers('fmcsa', { type: 'new_filing', limit: 100 }); // paid
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Python
|
|
42
|
+
|
|
43
|
+
```python
|
|
44
|
+
from registryhound import RegistryHound
|
|
45
|
+
|
|
46
|
+
rh = RegistryHound() # api_key from REGISTRYHOUND_API_KEY for paid calls
|
|
47
|
+
results = rh.search("walmart", limit=5)["results"]
|
|
48
|
+
apple = rh.entity("sec", "320193")
|
|
49
|
+
feed = rh.triggers("fmcsa", type="new_filing", limit=100) # paid
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Citing records
|
|
53
|
+
|
|
54
|
+
Every record has one stable canonical URL (`rh.url(market, id)`), and its JSON carries a `citation` string. Data is republished from the official federal sources named on each page; verify there before relying on it. RegistryHound is not a consumer reporting agency and its data must not be used for FCRA purposes.
|
|
55
|
+
|
|
56
|
+
## License
|
|
57
|
+
|
|
58
|
+
MIT © Opimus LLC
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# RegistryHound clients
|
|
2
|
+
|
|
3
|
+
Zero-dependency JavaScript and Python clients for [RegistryHound](https://registryhound.com), which republishes US federal public registries with daily change detection: FMCSA motor carriers, FAA aircraft, SEC EDGAR companies, CMS NPI, OSHA inspections, USAspending awards, EPA ECHO, openFDA and NHTSA recalls, SAM.gov, FCC ULS, USPTO trademarks, FDIC banks, USDA organic operations, MSHA mines, OFAC sanctions, CFPB complaints and more.
|
|
4
|
+
|
|
5
|
+
| Package | Path | Install |
|
|
6
|
+
|---|---|---|
|
|
7
|
+
| JavaScript / TypeScript (Node 18+, browsers, Deno, Bun) | js | `npm install registryhound` |
|
|
8
|
+
| Python 3.9+ | python | `pip install registryhound` |
|
|
9
|
+
|
|
10
|
+
Free endpoints (search, per-record JSON and Markdown) need no key. The change-detection API (`/api/v1`: trigger feeds, entity API, cross-registry resolver, webhooks) takes an API key, or pays per request with [x402](https://registryhound.com/.well-known/x402.json). Docs: <https://registryhound.com/docs> · OpenAPI: <https://registryhound.com/openapi.json> · MCP server: [registryhound-mcp](https://github.com/Baffles78/registryhound-mcp).
|
|
11
|
+
|
|
12
|
+
## JavaScript
|
|
13
|
+
|
|
14
|
+
```js
|
|
15
|
+
import { RegistryHound } from 'registryhound';
|
|
16
|
+
|
|
17
|
+
const rh = new RegistryHound(); // apiKey from REGISTRYHOUND_API_KEY for paid calls
|
|
18
|
+
const { results } = await rh.search('walmart', { limit: 5 });
|
|
19
|
+
const apple = await rh.entity('sec', '320193'); // JSON, includes a ready-made `citation`
|
|
20
|
+
const dossier = await rh.markdown('fmcsa', '3405079'); // token-efficient Markdown for LLM context
|
|
21
|
+
const feed = await rh.triggers('fmcsa', { type: 'new_filing', limit: 100 }); // paid
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Python
|
|
25
|
+
|
|
26
|
+
```python
|
|
27
|
+
from registryhound import RegistryHound
|
|
28
|
+
|
|
29
|
+
rh = RegistryHound() # api_key from REGISTRYHOUND_API_KEY for paid calls
|
|
30
|
+
results = rh.search("walmart", limit=5)["results"]
|
|
31
|
+
apple = rh.entity("sec", "320193")
|
|
32
|
+
feed = rh.triggers("fmcsa", type="new_filing", limit=100) # paid
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Citing records
|
|
36
|
+
|
|
37
|
+
Every record has one stable canonical URL (`rh.url(market, id)`), and its JSON carries a `citation` string. Data is republished from the official federal sources named on each page; verify there before relying on it. RegistryHound is not a consumer reporting agency and its data must not be used for FCRA purposes.
|
|
38
|
+
|
|
39
|
+
## License
|
|
40
|
+
|
|
41
|
+
MIT © Opimus LLC
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "registryhound"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Zero-dependency client for RegistryHound: US federal public registries (FMCSA, FAA, SEC, NPI, OFAC, FDIC and more) with change detection"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = "MIT"
|
|
11
|
+
license-files = ["LICENSE"]
|
|
12
|
+
authors = [{ name = "Opimus LLC" }]
|
|
13
|
+
requires-python = ">=3.9"
|
|
14
|
+
keywords = ["registryhound", "fmcsa", "usdot", "faa", "sec", "edgar", "npi", "ofac", "fdic", "public records", "x402"]
|
|
15
|
+
classifiers = ["Programming Language :: Python :: 3", "Operating System :: OS Independent", "Typing :: Typed"]
|
|
16
|
+
|
|
17
|
+
[project.urls]
|
|
18
|
+
Homepage = "https://registryhound.com"
|
|
19
|
+
Documentation = "https://registryhound.com/docs"
|
|
20
|
+
Source = "https://github.com/Baffles78/registryhound-clients"
|
|
21
|
+
|
|
22
|
+
[tool.hatch.build.targets.wheel]
|
|
23
|
+
packages = ["registryhound"]
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"""RegistryHound client: zero dependencies (standard library only).
|
|
2
|
+
|
|
3
|
+
Free endpoints need no key. Paid /api/v1 endpoints take an API key (x-api-key),
|
|
4
|
+
from the constructor or the REGISTRYHOUND_API_KEY environment variable.
|
|
5
|
+
"""
|
|
6
|
+
from __future__ import annotations
|
|
7
|
+
|
|
8
|
+
import json
|
|
9
|
+
import os
|
|
10
|
+
import urllib.error
|
|
11
|
+
import urllib.parse
|
|
12
|
+
import urllib.request
|
|
13
|
+
from typing import Any, Optional
|
|
14
|
+
|
|
15
|
+
__version__ = "0.1.0"
|
|
16
|
+
__all__ = ["RegistryHound", "RegistryHoundError"]
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class RegistryHoundError(Exception):
|
|
20
|
+
def __init__(self, status: int, body: Any, url: str):
|
|
21
|
+
super().__init__(f"RegistryHound {status} for {url}")
|
|
22
|
+
self.status, self.body, self.url = status, body, url
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def _q(s: Any) -> str:
|
|
26
|
+
return urllib.parse.quote(str(s), safe="")
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
class RegistryHound:
|
|
30
|
+
def __init__(self, api_key: Optional[str] = None, base_url: str = "https://registryhound.com", timeout: float = 30.0, opener=None):
|
|
31
|
+
self.api_key = api_key or os.environ.get("REGISTRYHOUND_API_KEY")
|
|
32
|
+
self.base_url = base_url.rstrip("/")
|
|
33
|
+
self.timeout = timeout
|
|
34
|
+
self._open = opener or urllib.request.urlopen
|
|
35
|
+
|
|
36
|
+
def request(self, path: str, query: Optional[dict] = None, paid: bool = False, method: str = "GET", body: Any = None, text: bool = False) -> Any:
|
|
37
|
+
params = {k: (",".join(v) if isinstance(v, (list, tuple)) else v) for k, v in (query or {}).items() if v not in (None, "")}
|
|
38
|
+
url = self.base_url + path + (("?" + urllib.parse.urlencode(params)) if params else "")
|
|
39
|
+
headers = {"Accept": "text/markdown" if text else "application/json", "User-Agent": f"registryhound-python/{__version__}"}
|
|
40
|
+
if paid and self.api_key:
|
|
41
|
+
headers["x-api-key"] = self.api_key
|
|
42
|
+
data = None
|
|
43
|
+
if body is not None:
|
|
44
|
+
data = json.dumps(body).encode()
|
|
45
|
+
headers["Content-Type"] = "application/json"
|
|
46
|
+
req = urllib.request.Request(url, data=data, headers=headers, method=method)
|
|
47
|
+
try:
|
|
48
|
+
with self._open(req, timeout=self.timeout) as res:
|
|
49
|
+
raw = res.read().decode("utf-8")
|
|
50
|
+
except urllib.error.HTTPError as e:
|
|
51
|
+
raw = e.read().decode("utf-8", "replace")
|
|
52
|
+
try:
|
|
53
|
+
parsed: Any = json.loads(raw)
|
|
54
|
+
except ValueError:
|
|
55
|
+
parsed = raw
|
|
56
|
+
raise RegistryHoundError(e.code, parsed, url) from None
|
|
57
|
+
return raw if text else json.loads(raw)
|
|
58
|
+
|
|
59
|
+
# ---- free, keyless
|
|
60
|
+
def search(self, q: str, market: Optional[str] = None, limit: Optional[int] = None) -> Any:
|
|
61
|
+
return self.request("/search.json", {"q": q, "market": market, "limit": limit})
|
|
62
|
+
|
|
63
|
+
def entity(self, market: str, id: str) -> Any:
|
|
64
|
+
return self.request(f"/{_q(market)}/entity/{_q(id)}.json")
|
|
65
|
+
|
|
66
|
+
def markdown(self, market: str, id: str) -> str:
|
|
67
|
+
return self.request(f"/{_q(market)}/entity/{_q(id)}.md", text=True)
|
|
68
|
+
|
|
69
|
+
def url(self, market: str, id: str) -> str:
|
|
70
|
+
return f"{self.base_url}/{_q(market)}/entity/{_q(id)}"
|
|
71
|
+
|
|
72
|
+
# ---- paid (API key or x402)
|
|
73
|
+
def triggers(self, market: str, **params: Any) -> Any:
|
|
74
|
+
return self.request(f"/api/v1/{_q(market)}/triggers", params, paid=True)
|
|
75
|
+
|
|
76
|
+
def api_entity(self, market: str, id: str) -> Any:
|
|
77
|
+
return self.request(f"/api/v1/{_q(market)}/entity/{_q(id)}", paid=True)
|
|
78
|
+
|
|
79
|
+
def resolve(self, **params: Any) -> Any:
|
|
80
|
+
return self.request("/api/v1/resolve", params, paid=True)
|
|
81
|
+
|
|
82
|
+
def list_webhooks(self, market: str) -> Any:
|
|
83
|
+
return self.request(f"/api/v1/{_q(market)}/webhooks", paid=True)
|
|
84
|
+
|
|
85
|
+
def create_webhook(self, market: str, body: dict) -> Any:
|
|
86
|
+
return self.request(f"/api/v1/{_q(market)}/webhooks", paid=True, method="POST", body=body)
|
|
File without changes
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import io, json, unittest, urllib.error
|
|
2
|
+
from registryhound import RegistryHound, RegistryHoundError
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class Fake:
|
|
6
|
+
def __init__(self, status=200, body=None):
|
|
7
|
+
self.status, self.body, self.calls = status, body if body is not None else {"ok": 1}, []
|
|
8
|
+
|
|
9
|
+
def __call__(self, req, timeout=None):
|
|
10
|
+
self.calls.append(req)
|
|
11
|
+
raw = json.dumps(self.body).encode()
|
|
12
|
+
if self.status >= 400:
|
|
13
|
+
raise urllib.error.HTTPError(req.full_url, self.status, "x", {}, io.BytesIO(raw))
|
|
14
|
+
return io.BytesIO(raw)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class ClientTest(unittest.TestCase):
|
|
18
|
+
def test_free_urls_no_key(self):
|
|
19
|
+
f = Fake()
|
|
20
|
+
rh = RegistryHound(api_key="k", opener=f)
|
|
21
|
+
rh.search("acme trucking", market="fmcsa", limit=5)
|
|
22
|
+
rh.entity("faa", "N 123")
|
|
23
|
+
self.assertEqual(f.calls[0].full_url, "https://registryhound.com/search.json?q=acme+trucking&market=fmcsa&limit=5")
|
|
24
|
+
self.assertEqual(f.calls[1].full_url, "https://registryhound.com/faa/entity/N%20123.json")
|
|
25
|
+
self.assertIsNone(f.calls[0].get_header("X-api-key"))
|
|
26
|
+
|
|
27
|
+
def test_paid_key_and_errors(self):
|
|
28
|
+
f = Fake()
|
|
29
|
+
RegistryHound(api_key="k", opener=f, base_url="http://x/").resolve(q="acme", markets=["sec", "sam"])
|
|
30
|
+
self.assertEqual(f.calls[0].full_url, "http://x/api/v1/resolve?q=acme&markets=sec%2Csam")
|
|
31
|
+
self.assertEqual(f.calls[0].get_header("X-api-key"), "k")
|
|
32
|
+
with self.assertRaises(RegistryHoundError) as cm:
|
|
33
|
+
RegistryHound(opener=Fake(402, {"error": "payment_required"})).triggers("fmcsa")
|
|
34
|
+
self.assertEqual(cm.exception.status, 402)
|
|
35
|
+
self.assertEqual(cm.exception.body["error"], "payment_required")
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
if __name__ == "__main__":
|
|
39
|
+
unittest.main()
|