companystack 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.
- companystack-0.1.0/.gitignore +7 -0
- companystack-0.1.0/LICENSE +21 -0
- companystack-0.1.0/PKG-INFO +181 -0
- companystack-0.1.0/README.md +146 -0
- companystack-0.1.0/pyproject.toml +60 -0
- companystack-0.1.0/src/companystack/__init__.py +41 -0
- companystack-0.1.0/src/companystack/_base.py +384 -0
- companystack-0.1.0/src/companystack/_generated.py +6564 -0
- companystack-0.1.0/src/companystack/_version.py +1 -0
- companystack-0.1.0/src/companystack/py.typed +0 -0
- companystack-0.1.0/tests/__init__.py +0 -0
- companystack-0.1.0/tests/mock_server.py +115 -0
- companystack-0.1.0/tests/test_client.py +167 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 CompanyStack Limited
|
|
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,181 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: companystack
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Python client for the CompanyStack API: UK company data from Companies House (profiles, officers, PSCs, filings, financials, health scores, KYB, change feed, lists).
|
|
5
|
+
Project-URL: Homepage, https://github.com/CompanyStackLtd/companystack-python
|
|
6
|
+
Project-URL: Repository, https://github.com/CompanyStackLtd/companystack-python
|
|
7
|
+
Project-URL: Issues, https://github.com/CompanyStackLtd/companystack-python/issues
|
|
8
|
+
Project-URL: Documentation, https://companystack.co.uk/docs
|
|
9
|
+
Project-URL: API reference, https://api.companystack.co.uk/docs
|
|
10
|
+
Project-URL: Free API key, https://companystack.co.uk/signup?product=api&utm_source=pypi
|
|
11
|
+
Project-URL: Pricing, https://companystack.co.uk/pricing?product=api&utm_source=pypi
|
|
12
|
+
Author-email: CompanyStack Limited <support@companystack.co.uk>
|
|
13
|
+
License-Expression: MIT
|
|
14
|
+
License-File: LICENSE
|
|
15
|
+
Keywords: api-client,beneficial-ownership,companies-house,company-data,companystack,due-diligence,kyb,psc,uk
|
|
16
|
+
Classifier: Development Status :: 4 - Beta
|
|
17
|
+
Classifier: Intended Audience :: Developers
|
|
18
|
+
Classifier: Operating System :: OS Independent
|
|
19
|
+
Classifier: Programming Language :: Python :: 3
|
|
20
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
24
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
25
|
+
Classifier: Topic :: Office/Business :: Financial
|
|
26
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
27
|
+
Classifier: Typing :: Typed
|
|
28
|
+
Requires-Python: >=3.10
|
|
29
|
+
Requires-Dist: httpx<1,>=0.25
|
|
30
|
+
Requires-Dist: typing-extensions>=4.7
|
|
31
|
+
Provides-Extra: test
|
|
32
|
+
Requires-Dist: mypy>=1.10; extra == 'test'
|
|
33
|
+
Requires-Dist: pytest>=8; extra == 'test'
|
|
34
|
+
Description-Content-Type: text/markdown
|
|
35
|
+
|
|
36
|
+
# CompanyStack for Python
|
|
37
|
+
|
|
38
|
+
The Python client for the [CompanyStack API](https://companystack.co.uk/docs?utm_source=pypi): UK company data from Companies House. It covers company search and profiles, officers, persons with significant control, filing history, financials parsed from filed accounts, health scores, KYB checks, the register change feed and your company lists.
|
|
39
|
+
|
|
40
|
+
- Typed: every response model is a `TypedDict`, so mypy and your editor know the fields.
|
|
41
|
+
- Sync (`CompanyStack`) and asyncio (`AsyncCompanyStack`) clients on [httpx](https://www.python-httpx.org/).
|
|
42
|
+
- Retries a 429 after `Retry-After`, and retries 5xx and network errors on reads.
|
|
43
|
+
- Pagination helpers (`iter_*`) for search, filings, list items, the change feed, KYB checks and prospects.
|
|
44
|
+
|
|
45
|
+
Requires Python 3.9 or later.
|
|
46
|
+
|
|
47
|
+
## Install
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
pip install companystack
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Quick start
|
|
54
|
+
|
|
55
|
+
Get an API key (it starts with `cs_`) by [signing up free](https://companystack.co.uk/signup?product=api&utm_source=pypi): no card, 1,000 requests a day on the Free plan. Then set it in `COMPANYSTACK_API_KEY`, or pass `api_key=`.
|
|
56
|
+
|
|
57
|
+
```python
|
|
58
|
+
from companystack import CompanyStack
|
|
59
|
+
|
|
60
|
+
cs = CompanyStack() # reads COMPANYSTACK_API_KEY
|
|
61
|
+
|
|
62
|
+
results = cs.search_companies(q="tesco", limit=5)
|
|
63
|
+
for company in results["results"]:
|
|
64
|
+
print(company["company_number"], company["company_name"], company["company_status"])
|
|
65
|
+
|
|
66
|
+
profile = cs.get_company("00445790")
|
|
67
|
+
print(profile["accounts"]["next_due"])
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Examples
|
|
71
|
+
|
|
72
|
+
```python
|
|
73
|
+
# Officers and beneficial owners (Starter plan and above)
|
|
74
|
+
officers = cs.list_officers("00445790")
|
|
75
|
+
pscs = cs.list_persons_with_significant_control("00445790")
|
|
76
|
+
|
|
77
|
+
# Financials from filed accounts. Money values are whole pounds (GBP) as filed, not pence.
|
|
78
|
+
history = cs.get_financial_history("06450847")
|
|
79
|
+
for period in history["periods"]:
|
|
80
|
+
print(period["balance_sheet_date"], period["net_assets"], period["turnover"])
|
|
81
|
+
|
|
82
|
+
# Health score: a rules-based 0-100 indicator (not a credit rating)
|
|
83
|
+
score = cs.get_health_score("06450847")
|
|
84
|
+
print(score["overall_score"], score["grade"], score["risk_level"])
|
|
85
|
+
|
|
86
|
+
# KYB check. Each call uses quota and stores a record on your account.
|
|
87
|
+
check = cs.run_kyb_check({"company_number": "06450847", "expected_name": "Club Free Spirit Limited", "reference": "client-42"})
|
|
88
|
+
print(check["outcome"], check["reason_codes"])
|
|
89
|
+
|
|
90
|
+
# Every search result, fetching pages as you go
|
|
91
|
+
for company in cs.iter_search_companies(q="bakery", town="LEEDS", max_items=200):
|
|
92
|
+
print(company["company_name"])
|
|
93
|
+
|
|
94
|
+
# The change feed: store the cursor and resume from it next time
|
|
95
|
+
page = cs.list_changes(types="added,dissolved", postcode="LS")
|
|
96
|
+
cursor = page["next_cursor"]
|
|
97
|
+
|
|
98
|
+
# Your lists
|
|
99
|
+
lists = cs.list_lists()
|
|
100
|
+
cs.add_list_items(42, {"items": [{"company_number": "00445790", "custom_ref": "CL-0042"}]})
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### asyncio
|
|
104
|
+
|
|
105
|
+
```python
|
|
106
|
+
import asyncio
|
|
107
|
+
from companystack import AsyncCompanyStack
|
|
108
|
+
|
|
109
|
+
async def main():
|
|
110
|
+
async with AsyncCompanyStack() as cs:
|
|
111
|
+
company = await cs.get_company("00445790")
|
|
112
|
+
async for event in cs.iter_list_changes(types="added", max_items=100):
|
|
113
|
+
print(event["company_number"], event["change_type"])
|
|
114
|
+
|
|
115
|
+
asyncio.run(main())
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
## Errors
|
|
119
|
+
|
|
120
|
+
Every failure raises a subclass of `CompanyStackError`, which carries `status`, `code`, `body`, `upgrade_url` and `retry_after`:
|
|
121
|
+
|
|
122
|
+
| Exception | When |
|
|
123
|
+
| --- | --- |
|
|
124
|
+
| `AuthenticationError` | 401: the key is missing, malformed or revoked |
|
|
125
|
+
| `PermissionDeniedError` | 403: your plan does not include the endpoint (`code == "plan_upgrade_required"`; see `upgrade_url`) |
|
|
126
|
+
| `NotFoundError` | 404 |
|
|
127
|
+
| `ValidationError` | 400 or 422 |
|
|
128
|
+
| `ConflictError` | 409 |
|
|
129
|
+
| `RateLimitError` | 429 after the retries; `retry_after` says how long to wait |
|
|
130
|
+
| `ServerError` | 5xx |
|
|
131
|
+
| `APIConnectionError` | No response (network error or timeout) |
|
|
132
|
+
|
|
133
|
+
```python
|
|
134
|
+
from companystack import CompanyStack, PermissionDeniedError, RateLimitError
|
|
135
|
+
|
|
136
|
+
try:
|
|
137
|
+
cs.get_health_score("00445790")
|
|
138
|
+
except PermissionDeniedError as e:
|
|
139
|
+
print("Upgrade at", e.upgrade_url)
|
|
140
|
+
except RateLimitError as e:
|
|
141
|
+
print("Try again in", e.retry_after, "seconds")
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
## Configuration
|
|
145
|
+
|
|
146
|
+
```python
|
|
147
|
+
CompanyStack(
|
|
148
|
+
api_key="cs_…", # default: COMPANYSTACK_API_KEY
|
|
149
|
+
base_url="https://api.companystack.co.uk",
|
|
150
|
+
timeout=30.0, # seconds per attempt
|
|
151
|
+
max_retries=2, # 429 on any method; 5xx and network errors on GET
|
|
152
|
+
max_retry_delay=60.0, # cap on Retry-After waits
|
|
153
|
+
http_client=None, # bring your own httpx.Client (proxies, transports)
|
|
154
|
+
)
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
After each call, `cs.last_rate_limit` holds the rate-limit headers (`limit`, `remaining`, `reset`, `daily_limit`, `daily_remaining`). What each plan includes, and its limits, is on the [pricing page](https://companystack.co.uk/pricing?product=api&utm_source=pypi).
|
|
158
|
+
|
|
159
|
+
## Development
|
|
160
|
+
|
|
161
|
+
`_generated.py` is generated from the [OpenAPI specification](https://api.companystack.co.uk/openapi.json) and is replaced on each release, so send changes to `_base.py` (the runtime) or open an issue.
|
|
162
|
+
|
|
163
|
+
```bash
|
|
164
|
+
pip install -e ".[test]"
|
|
165
|
+
pytest # runs against a local mock server; no network, no key
|
|
166
|
+
mypy
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
## Pricing
|
|
170
|
+
|
|
171
|
+
Free API plan: £0, 1,000 requests a day, 30 a minute, no card: search (first page, up to 10 results), autocomplete and full company profiles. Starter: £29/month or £288/year, adding officers, owners (PSC), filing history, filed accounts and health scores. Pay as you go, without a monthly plan: prepaid credits from £10 (1,000 credits), used only for calls your plan does not include. Current prices and limits: [companystack.co.uk/pricing](https://companystack.co.uk/pricing?product=api).
|
|
172
|
+
|
|
173
|
+
## About the data
|
|
174
|
+
|
|
175
|
+
The data is a copy of public registers (Companies House and the others listed at [companystack.co.uk/data-sources](https://companystack.co.uk/data-sources)), as CompanyStack holds them, and can be incomplete or out of date. Register details and accounts figures are the company's own filings, shown as filed: CompanyStack does not audit or verify them. Health scores and KYB results are indicators that support your own checks, not credit ratings or advice.
|
|
176
|
+
|
|
177
|
+
Contains public sector information licensed under the [Open Government Licence v3.0](https://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/). CompanyStack is not affiliated with or endorsed by Companies House.
|
|
178
|
+
|
|
179
|
+
## Licence
|
|
180
|
+
|
|
181
|
+
MIT
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
# CompanyStack for Python
|
|
2
|
+
|
|
3
|
+
The Python client for the [CompanyStack API](https://companystack.co.uk/docs?utm_source=pypi): UK company data from Companies House. It covers company search and profiles, officers, persons with significant control, filing history, financials parsed from filed accounts, health scores, KYB checks, the register change feed and your company lists.
|
|
4
|
+
|
|
5
|
+
- Typed: every response model is a `TypedDict`, so mypy and your editor know the fields.
|
|
6
|
+
- Sync (`CompanyStack`) and asyncio (`AsyncCompanyStack`) clients on [httpx](https://www.python-httpx.org/).
|
|
7
|
+
- Retries a 429 after `Retry-After`, and retries 5xx and network errors on reads.
|
|
8
|
+
- Pagination helpers (`iter_*`) for search, filings, list items, the change feed, KYB checks and prospects.
|
|
9
|
+
|
|
10
|
+
Requires Python 3.9 or later.
|
|
11
|
+
|
|
12
|
+
## Install
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
pip install companystack
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Quick start
|
|
19
|
+
|
|
20
|
+
Get an API key (it starts with `cs_`) by [signing up free](https://companystack.co.uk/signup?product=api&utm_source=pypi): no card, 1,000 requests a day on the Free plan. Then set it in `COMPANYSTACK_API_KEY`, or pass `api_key=`.
|
|
21
|
+
|
|
22
|
+
```python
|
|
23
|
+
from companystack import CompanyStack
|
|
24
|
+
|
|
25
|
+
cs = CompanyStack() # reads COMPANYSTACK_API_KEY
|
|
26
|
+
|
|
27
|
+
results = cs.search_companies(q="tesco", limit=5)
|
|
28
|
+
for company in results["results"]:
|
|
29
|
+
print(company["company_number"], company["company_name"], company["company_status"])
|
|
30
|
+
|
|
31
|
+
profile = cs.get_company("00445790")
|
|
32
|
+
print(profile["accounts"]["next_due"])
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Examples
|
|
36
|
+
|
|
37
|
+
```python
|
|
38
|
+
# Officers and beneficial owners (Starter plan and above)
|
|
39
|
+
officers = cs.list_officers("00445790")
|
|
40
|
+
pscs = cs.list_persons_with_significant_control("00445790")
|
|
41
|
+
|
|
42
|
+
# Financials from filed accounts. Money values are whole pounds (GBP) as filed, not pence.
|
|
43
|
+
history = cs.get_financial_history("06450847")
|
|
44
|
+
for period in history["periods"]:
|
|
45
|
+
print(period["balance_sheet_date"], period["net_assets"], period["turnover"])
|
|
46
|
+
|
|
47
|
+
# Health score: a rules-based 0-100 indicator (not a credit rating)
|
|
48
|
+
score = cs.get_health_score("06450847")
|
|
49
|
+
print(score["overall_score"], score["grade"], score["risk_level"])
|
|
50
|
+
|
|
51
|
+
# KYB check. Each call uses quota and stores a record on your account.
|
|
52
|
+
check = cs.run_kyb_check({"company_number": "06450847", "expected_name": "Club Free Spirit Limited", "reference": "client-42"})
|
|
53
|
+
print(check["outcome"], check["reason_codes"])
|
|
54
|
+
|
|
55
|
+
# Every search result, fetching pages as you go
|
|
56
|
+
for company in cs.iter_search_companies(q="bakery", town="LEEDS", max_items=200):
|
|
57
|
+
print(company["company_name"])
|
|
58
|
+
|
|
59
|
+
# The change feed: store the cursor and resume from it next time
|
|
60
|
+
page = cs.list_changes(types="added,dissolved", postcode="LS")
|
|
61
|
+
cursor = page["next_cursor"]
|
|
62
|
+
|
|
63
|
+
# Your lists
|
|
64
|
+
lists = cs.list_lists()
|
|
65
|
+
cs.add_list_items(42, {"items": [{"company_number": "00445790", "custom_ref": "CL-0042"}]})
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### asyncio
|
|
69
|
+
|
|
70
|
+
```python
|
|
71
|
+
import asyncio
|
|
72
|
+
from companystack import AsyncCompanyStack
|
|
73
|
+
|
|
74
|
+
async def main():
|
|
75
|
+
async with AsyncCompanyStack() as cs:
|
|
76
|
+
company = await cs.get_company("00445790")
|
|
77
|
+
async for event in cs.iter_list_changes(types="added", max_items=100):
|
|
78
|
+
print(event["company_number"], event["change_type"])
|
|
79
|
+
|
|
80
|
+
asyncio.run(main())
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## Errors
|
|
84
|
+
|
|
85
|
+
Every failure raises a subclass of `CompanyStackError`, which carries `status`, `code`, `body`, `upgrade_url` and `retry_after`:
|
|
86
|
+
|
|
87
|
+
| Exception | When |
|
|
88
|
+
| --- | --- |
|
|
89
|
+
| `AuthenticationError` | 401: the key is missing, malformed or revoked |
|
|
90
|
+
| `PermissionDeniedError` | 403: your plan does not include the endpoint (`code == "plan_upgrade_required"`; see `upgrade_url`) |
|
|
91
|
+
| `NotFoundError` | 404 |
|
|
92
|
+
| `ValidationError` | 400 or 422 |
|
|
93
|
+
| `ConflictError` | 409 |
|
|
94
|
+
| `RateLimitError` | 429 after the retries; `retry_after` says how long to wait |
|
|
95
|
+
| `ServerError` | 5xx |
|
|
96
|
+
| `APIConnectionError` | No response (network error or timeout) |
|
|
97
|
+
|
|
98
|
+
```python
|
|
99
|
+
from companystack import CompanyStack, PermissionDeniedError, RateLimitError
|
|
100
|
+
|
|
101
|
+
try:
|
|
102
|
+
cs.get_health_score("00445790")
|
|
103
|
+
except PermissionDeniedError as e:
|
|
104
|
+
print("Upgrade at", e.upgrade_url)
|
|
105
|
+
except RateLimitError as e:
|
|
106
|
+
print("Try again in", e.retry_after, "seconds")
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
## Configuration
|
|
110
|
+
|
|
111
|
+
```python
|
|
112
|
+
CompanyStack(
|
|
113
|
+
api_key="cs_…", # default: COMPANYSTACK_API_KEY
|
|
114
|
+
base_url="https://api.companystack.co.uk",
|
|
115
|
+
timeout=30.0, # seconds per attempt
|
|
116
|
+
max_retries=2, # 429 on any method; 5xx and network errors on GET
|
|
117
|
+
max_retry_delay=60.0, # cap on Retry-After waits
|
|
118
|
+
http_client=None, # bring your own httpx.Client (proxies, transports)
|
|
119
|
+
)
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
After each call, `cs.last_rate_limit` holds the rate-limit headers (`limit`, `remaining`, `reset`, `daily_limit`, `daily_remaining`). What each plan includes, and its limits, is on the [pricing page](https://companystack.co.uk/pricing?product=api&utm_source=pypi).
|
|
123
|
+
|
|
124
|
+
## Development
|
|
125
|
+
|
|
126
|
+
`_generated.py` is generated from the [OpenAPI specification](https://api.companystack.co.uk/openapi.json) and is replaced on each release, so send changes to `_base.py` (the runtime) or open an issue.
|
|
127
|
+
|
|
128
|
+
```bash
|
|
129
|
+
pip install -e ".[test]"
|
|
130
|
+
pytest # runs against a local mock server; no network, no key
|
|
131
|
+
mypy
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
## Pricing
|
|
135
|
+
|
|
136
|
+
Free API plan: £0, 1,000 requests a day, 30 a minute, no card: search (first page, up to 10 results), autocomplete and full company profiles. Starter: £29/month or £288/year, adding officers, owners (PSC), filing history, filed accounts and health scores. Pay as you go, without a monthly plan: prepaid credits from £10 (1,000 credits), used only for calls your plan does not include. Current prices and limits: [companystack.co.uk/pricing](https://companystack.co.uk/pricing?product=api).
|
|
137
|
+
|
|
138
|
+
## About the data
|
|
139
|
+
|
|
140
|
+
The data is a copy of public registers (Companies House and the others listed at [companystack.co.uk/data-sources](https://companystack.co.uk/data-sources)), as CompanyStack holds them, and can be incomplete or out of date. Register details and accounts figures are the company's own filings, shown as filed: CompanyStack does not audit or verify them. Health scores and KYB results are indicators that support your own checks, not credit ratings or advice.
|
|
141
|
+
|
|
142
|
+
Contains public sector information licensed under the [Open Government Licence v3.0](https://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/). CompanyStack is not affiliated with or endorsed by Companies House.
|
|
143
|
+
|
|
144
|
+
## Licence
|
|
145
|
+
|
|
146
|
+
MIT
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling>=1.27.0"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "companystack"
|
|
7
|
+
dynamic = ["version"]
|
|
8
|
+
description = "Python client for the CompanyStack API: UK company data from Companies House (profiles, officers, PSCs, filings, financials, health scores, KYB, change feed, lists)."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.10"
|
|
11
|
+
license = "MIT"
|
|
12
|
+
license-files = ["LICENSE"]
|
|
13
|
+
authors = [{ name = "CompanyStack Limited", email = "support@companystack.co.uk" }]
|
|
14
|
+
keywords = ["companystack", "companies-house", "uk", "company-data", "kyb", "due-diligence", "beneficial-ownership", "psc", "api-client"]
|
|
15
|
+
classifiers = [
|
|
16
|
+
"Development Status :: 4 - Beta",
|
|
17
|
+
"Intended Audience :: Developers",
|
|
18
|
+
"Operating System :: OS Independent",
|
|
19
|
+
"Programming Language :: Python :: 3",
|
|
20
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
21
|
+
"Programming Language :: Python :: 3.10",
|
|
22
|
+
"Programming Language :: Python :: 3.11",
|
|
23
|
+
"Programming Language :: Python :: 3.12",
|
|
24
|
+
"Programming Language :: Python :: 3.13",
|
|
25
|
+
"Topic :: Office/Business :: Financial",
|
|
26
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
27
|
+
"Typing :: Typed",
|
|
28
|
+
]
|
|
29
|
+
dependencies = [
|
|
30
|
+
"httpx>=0.25,<1",
|
|
31
|
+
"typing-extensions>=4.7",
|
|
32
|
+
]
|
|
33
|
+
|
|
34
|
+
[project.optional-dependencies]
|
|
35
|
+
test = ["pytest>=8", "mypy>=1.10"]
|
|
36
|
+
|
|
37
|
+
[project.urls]
|
|
38
|
+
Homepage = "https://github.com/CompanyStackLtd/companystack-python"
|
|
39
|
+
Repository = "https://github.com/CompanyStackLtd/companystack-python"
|
|
40
|
+
Issues = "https://github.com/CompanyStackLtd/companystack-python/issues"
|
|
41
|
+
Documentation = "https://companystack.co.uk/docs"
|
|
42
|
+
"API reference" = "https://api.companystack.co.uk/docs"
|
|
43
|
+
"Free API key" = "https://companystack.co.uk/signup?product=api&utm_source=pypi"
|
|
44
|
+
Pricing = "https://companystack.co.uk/pricing?product=api&utm_source=pypi"
|
|
45
|
+
|
|
46
|
+
[tool.hatch.version]
|
|
47
|
+
path = "src/companystack/_version.py"
|
|
48
|
+
|
|
49
|
+
[tool.hatch.build.targets.sdist]
|
|
50
|
+
include = ["src/companystack", "tests", "README.md", "LICENSE", "pyproject.toml"]
|
|
51
|
+
|
|
52
|
+
[tool.hatch.build.targets.wheel]
|
|
53
|
+
packages = ["src/companystack"]
|
|
54
|
+
|
|
55
|
+
[tool.pytest.ini_options]
|
|
56
|
+
testpaths = ["tests"]
|
|
57
|
+
|
|
58
|
+
[tool.mypy]
|
|
59
|
+
strict = true
|
|
60
|
+
files = ["src/companystack"]
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"""CompanyStack API client: UK company data from Companies House.
|
|
2
|
+
|
|
3
|
+
.. code-block:: python
|
|
4
|
+
|
|
5
|
+
from companystack import CompanyStack
|
|
6
|
+
|
|
7
|
+
cs = CompanyStack() # reads COMPANYSTACK_API_KEY
|
|
8
|
+
print(cs.get_company("00445790")["company_name"])
|
|
9
|
+
"""
|
|
10
|
+
from ._base import (
|
|
11
|
+
DEFAULT_BASE_URL,
|
|
12
|
+
APIConnectionError,
|
|
13
|
+
AuthenticationError,
|
|
14
|
+
CompanyStackError,
|
|
15
|
+
ConflictError,
|
|
16
|
+
NotFoundError,
|
|
17
|
+
PermissionDeniedError,
|
|
18
|
+
RateLimitError,
|
|
19
|
+
ServerError,
|
|
20
|
+
ValidationError,
|
|
21
|
+
)
|
|
22
|
+
from ._generated import * # noqa: F401,F403 (models: Company, HealthScore, …)
|
|
23
|
+
from ._generated import API_VERSION, AsyncCompanyStack, CompanyStack
|
|
24
|
+
from ._version import __version__
|
|
25
|
+
|
|
26
|
+
__all__ = [
|
|
27
|
+
"CompanyStack",
|
|
28
|
+
"AsyncCompanyStack",
|
|
29
|
+
"API_VERSION",
|
|
30
|
+
"DEFAULT_BASE_URL",
|
|
31
|
+
"CompanyStackError",
|
|
32
|
+
"ValidationError",
|
|
33
|
+
"AuthenticationError",
|
|
34
|
+
"PermissionDeniedError",
|
|
35
|
+
"NotFoundError",
|
|
36
|
+
"ConflictError",
|
|
37
|
+
"RateLimitError",
|
|
38
|
+
"ServerError",
|
|
39
|
+
"APIConnectionError",
|
|
40
|
+
"__version__",
|
|
41
|
+
]
|