Skip to main content

UK Companies House API

Reason this release was yanked:

Forgot to include the actual package code. Sorry.

Project description

Companies House API Python Client

CI License: MIT PyPI version

Async Python client for the Companies House API with type-safe Pydantic models, automatic pagination, and comprehensive error handling.

Features

  • Async-first with httpx
  • Type-safe Pydantic models
  • Automatic pagination handling
  • Optional rate limiting
  • 98%+ test coverage

Installation

pip install ch-api

Quick Start

Example of getting company information:

>>> async def get_company_example(client):
...     company = await client.get_company_profile("09370755")
...     return company is not None
>>> run_async_func(get_company_example)
True

Key Endpoints

  • Company: get_company_profile(), get_officer_list(), get_company_psc_list(), get_company_charges(), get_company_filing_history()
  • Search: search_companies(), search_officers(), search_disqualified_officers()
  • Sandbox: create_test_company() (TEST_API_SETTINGS only)

Pagination

List endpoints return MultipageList[T] with .data (list) and .pagination metadata:

>>> async def search_example(client):
...     results = await client.search_companies("tech", result_count=1)
...     return len(results.data) >= 1
>>> run_async_func(search_example)
True

Rate Limiting

The API allows 600 requests per 5 minutes. Use an async rate limiter:

>>> from asyncio_throttle import Throttler  # doctest: +SKIP

Error Handling

>>> import httpx  # doctest: +SKIP

Advanced Usage

Sandbox Environment

>>> from ch_api import Client, api_settings  # doctest: +SKIP

Custom HTTP Session

>>> import httpx  # doctest: +SKIP

Requirements

  • Python 3.11+
  • httpx >= 0.28.1
  • pydantic >= 2.12.5

Documentation

License

MIT License - See LICENSE file for details

Contributing

Please see CONTRIBUTING for development guidelines.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ch_api-1.2.0.tar.gz (349.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ch_api-1.2.0-py3-none-any.whl (2.7 kB view details)

Uploaded Python 3

File details

Details for the file ch_api-1.2.0.tar.gz.

File metadata

  • Download URL: ch_api-1.2.0.tar.gz
  • Upload date:
  • Size: 349.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: pdm/2.26.8 CPython/3.13.13 Linux/6.17.0-1011-azure

File hashes

Hashes for ch_api-1.2.0.tar.gz
Algorithm Hash digest
SHA256 5b222df862424880beb5682b298713098400d9b7a40f1689647777617367e363
MD5 598b90c58a4fc79ff7f647c0763d4492
BLAKE2b-256 61b9cba533ae2a11b650ae166a23796609873996e687f96d8c2e39922c50574a

See more details on using hashes here.

File details

Details for the file ch_api-1.2.0-py3-none-any.whl.

File metadata

  • Download URL: ch_api-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 2.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: pdm/2.26.8 CPython/3.13.13 Linux/6.17.0-1011-azure

File hashes

Hashes for ch_api-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e4c6912d79147df1cdcafde83691b9ff8d9d7d4cc1ef0154b659c3a3d7aba8a0
MD5 0cc0fd1d9d81a32771843cb1b3330339
BLAKE2b-256 1fdc482d51a56732bb6b93b805103163f1d56b327db14fee5b6e9e801bff3336

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page