Able to generate Token but receiving 401 error (Python)

Saturday, October 17, 2015 - 08:45
Gus Cavanaugh

I'm having some issues using the Python example in your repo

#I was able to successfully retrieve a token via:

response ='',
headers={'Content-Type': 'application/x-www-form-urlencoded',
'Authorization': 'Basic {}'.format(credential)}).json()

#But when I make a get request to the weather endpoint I get a 401 error

authorization = {'Authorization': 'Bearer {}'.format(response['access_token'])}

url = ''
params = {'latitude': '39.7096116',
'longitude': '-105.1045942',
'startDate': '2015-07-04'}
output = requests.get(url, params, headers=authorization)
print output.json()

{u'statusName': u'Unauthorized', u'detailedMessage': u'There is a problem with the access token being used for this request. Either it is missing, invalid, or has expired. Please generate a new access token and try the request again.', u'simpleMessage': u'API Access Expired', u'errorId': u'', u'statusCode': 401}

I've generated a new token five or six times with no effect. I assume it's a bug on my end, but I'm seeing the same 401 error when using the Postman GUI (also able to successfully generate a token using the Postman GUI but not hit any of the other endpoints)

Answer Count: 

Hi Gus, Sorry for the confusion, over the weekend we transitioned to our new API platform, and your account was enabled for the new APIs, but that code sample is still using the older ones. I've enabled your API key for the old APIs as well as the new, so those samples should start working again. Once you get them up and running, try swapping out the URIs to the new stuff, now documented here on the portal.

Monday, October 19, 2015 - 07:33
Jeof Oyster