Skip to main content

A Python client for the Companies House API

Project description

Companies House API Library

A Python client for interacting with the Companies House API.

PyPI version

Installation

This library is available on PyPI and can be installed with pip:

pip install companies-house-api-lib

Usage

To use the client, you need to have a Companies House API key. You can get one from the Companies House developer portal.

Once you have your key, you can either pass it to the client directly or set it as an environment variable named COMPANIES_HOUSE_API_KEY.

from companieshouse import CompaniesHouseClient

# Option 1: Pass the key directly
client = CompaniesHouseClient(api_key="YOUR_API_KEY")

# Option 2: Use an environment variable
# export COMPANIES_HOUSE_API_KEY="YOUR_API_KEY"
client = CompaniesHouseClient()

# Search for companies
search_results = client.search_companies("python")
print(search_results)

# Get a company profile
if search_results.get("items"):
    company_number = search_results["items"][0]["company_number"]
    company_profile = client.get_company_profile(company_number)
    print(company_profile)

Testing

A test file (test_library.py) is included in this repository. To run the tests, you will need to have your Companies House API key set as an environment variable.

export COMPANIES_HOUSE_API_KEY="YOUR_API_KEY"
python test_library.py

Available API Calls

Here is a list of the available API calls in this library:

  • search_all(query): Searches for all records in the Companies House API.
  • search_companies(query): Searches for companies.
  • get_company_profile(company_number): Gets the profile of a company.
  • get_company_officers(company_number): Gets the company officers.
  • get_company_filing_history(filing_history_url): Gets the company filing history.
  • get_company_registered_office_address(company_number): Gets the company office address.
  • get_company_registers(company_number): Gets the company registers details.
  • get_company_charges(company_number): Gets the company charges details.
  • get_company_insolvency(company_number): Gets the company insolvancy details.
  • get_company_exemptions(company_number): Gets the company exemptions details.
  • get_corporate_officer_disqualifications(officer_id): Gets the corporate officer disqualifications.
  • get_natural_officer_disqualifications(officer_id): Gets the natural officer disqualifications.
  • get_office_appointments(officer_id): Gets the officer appointments.
  • get_company_uk_establishments(company_number): Gets the company insolvancy details.

License

This project is licensed under the MIT License - see the LICENSE file for details.

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

companies_house_api_lib-0.2.tar.gz (7.6 kB view details)

Uploaded Source

Built Distribution

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

companies_house_api_lib-0.2-py3-none-any.whl (8.2 kB view details)

Uploaded Python 3

File details

Details for the file companies_house_api_lib-0.2.tar.gz.

File metadata

  • Download URL: companies_house_api_lib-0.2.tar.gz
  • Upload date:
  • Size: 7.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for companies_house_api_lib-0.2.tar.gz
Algorithm Hash digest
SHA256 0e4ca3f4652b8553a6c8edfd1cc6e9def10e540c04e33d50977fb054f1631ffd
MD5 a1f80087c2155dc4ee9d3a6daa105061
BLAKE2b-256 787480b9e707ec8974dd83f746d4f10e316cde21e99e6980769db9f0565ddfe7

See more details on using hashes here.

File details

Details for the file companies_house_api_lib-0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for companies_house_api_lib-0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 376aee2c9ff181ec4798e822976fc2730cb47ce8678ccd6cdfadf416744a30fd
MD5 ae8bae1cfe4eb41b7c7633f1c68f07c8
BLAKE2b-256 e6399b1d9c7cd9cefb54d1a1451bf830d32d8d318988d0ef128c9db099cdb0e2

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