Internal server error when accessing Broadband API through Python script

I have been attempting to make a request to the API and parse the return via a Python script, via two different methods. Both return a 500: Internal Server Error with no further information, except an activityId and I don't have a clue what that refers to. Any help on what I'm doing wrong would be greatly appreciated - code excerpt below, minus actual key headers = { # Request headers 'Ocp-Apim-Subscription-Key': 'key', } postcode = 'MK158AN' response = requests.get('{}%7D'.format(postcode), headers=headers) print(response.json()) Thanks in advance



    This is the python script I have used in a Jupyter Notebook. import http.client, urllib.request, urllib.parse, urllib.error, base64, json ## parameters pc = 'SE19HA' ## subscription keys fixed_basic_key = 'abcde12345' ## url api_url_root = '' fixed_url = '/broadband/coverage/' params = urllib.parse.urlencode({}) # Fixed Broadband headers = { # Request headers 'Ocp-Apim-Subscription-Key': fixed_basic_key, } try: conn = http.client.HTTPSConnection(api_url_root) conn.request("GET", fixed_url + pc + "?%s" % params, "{body}", headers) response = conn.getresponse() data = json.loads( print(json.dumps(data, indent=4)) conn.close() except Exception as e: print("[Errno {0}] {1}".format(e.errno, e.strerror))
    Posted by Hidden Tue, 20 Apr 2021 09:26:32 GMT
    I've attached the script as the formatting controls on this forum are not great.
    Posted by Hidden Tue, 20 Apr 2021 09:28:32 GMT
    Code works perfectly - amazing, thank you!! Will try to understand where I was going wrong now
    Posted by Hidden Tue, 20 Apr 2021 10:49:19 GMT

You're not signed in. Please sign-in to report an issue or post a comment.