companystack 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 @@
1
+ __version__ = "0.1.0"
companystack/py.typed ADDED
File without changes
@@ -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,9 @@
1
+ companystack/__init__.py,sha256=hXDB4FRbtFXtkYXwk3pJlng0PPcOt-GEmKyrj5QXxFo,1006
2
+ companystack/_base.py,sha256=2B62Lg3TmdoGTIyFtdDdJxhY5P25NDBIxRRvIl0gvxQ,15878
3
+ companystack/_generated.py,sha256=m-bEbvxsktr1FeriWxD86nQ-m-orzcPJgD-o1XpiC0M,415325
4
+ companystack/_version.py,sha256=kUR5RAFc7HCeiqdlX36dZOHkUI5wI6V_43RpEcD8b-0,22
5
+ companystack/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
+ companystack-0.1.0.dist-info/METADATA,sha256=WFC5ewepll1Mv_8dHhcy7sxTBxAWUl_eiR46tQKmc7g,8138
7
+ companystack-0.1.0.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
8
+ companystack-0.1.0.dist-info/licenses/LICENSE,sha256=gPclAn91B6P4266Rp0w8dinxrL_FsLfZQT7mF-FyN8o,1077
9
+ companystack-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.33.0
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -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.