Simple python script to access Companies House API

Hi all, Im not a developer but Im trying to work out how to access Companies house using a python script. Should something like this work?

import requests
url = '"01591116'
headers = {'my_api_key': '***********my_api_key**********'}
r = requests.get(url, headers=headers)
print r.text

Im getting this: {"error":"Invalid authorization header","type":"ch:service"}

I found it :slight_smile:

import requests

r = requests.get('', auth=('xxxxxxxxxxxxxxxxxxxxxxxxxxx', ''))

resurfacing this thread. can you elaborate how you achieved this? did you base64 encode the key? i tried without encoding and also with encoding, still it gives me 401 error.