I am currently having issues with the Companies House API and not sure what the issue is. I have created logins on Companies House and have created an app key but this still does not seem to be working. I cannot upload images as I am a new user or copy the links in the code as I cant create a topic with them in so copying the code as best as I can below.
Code 1:
import pandas as pd
import requests
import json
url = “https://api.companieshouse.gov.uk/search/companies?q={}”
query = “Marks and Spencer”
api_key = “{Pasted my app key here}”
r = requests.get(“https://api.companieshouse.gov.uk/company/04977362”,auth=(“{Pasted my app key here}”,‘’)).text
r
When creating your app did you specify that you wanted a live app? The test / sandbox mode may not work correctly.
Depending on how you’re requesting data from Companies House you need to register your IP or the host name (if you’re using a javascript-style request). This should be done where you’ve registered your app.
If you are just using a localhost set up rather than e.g. a fixed IP there is a workaround for that, see this thread:
If you are hosted on some environment with a range of host servers / IPs I think there’s a way to cover that but am not sure how. Search this forum / have a look at this thread: