KeyError: 'Response'
EasyAsABC123 opened this issue · 6 comments
EasyAsABC123 commented
$ ./dest_cf.py XBL Scythev9
Traceback (most recent call last):
File "./dest_cf.py", line 25, in
playerId = data3['Response'][0]['membershipId']
KeyError: 'Response'
EasyAsABC123 commented
{u'ErrorCode': 2102, u'Message': u'Please add valid X-API-Key header to request. Visit https://www.bungie.net/developer for details.', u'ErrorStatus': u'ApiKeyMissingFromRequest', u'ThrottleSeconds': 0, u'MessageData': {}}
EasyAsABC123 commented
you need to use: https://www.bungie.net/en/User/API to generate an apikey then add it to the header
req = urllib2.Request(url)
req.add_header('X-API-Key', apikey)
response = urllib2.urlopen(req)
EasyAsABC123 commented
also the results are just wrong...literally wrong...
paultravers commented
OK, working on the apikey, could you be more specific on how the results are "wrong" ?
EasyAsABC123 commented
it is returning:
-------
XVI: The Sword Logic
-------
-------
XVII: The Weakness Verse
-------
-------
XVIII: Leviathan Rises
-------
-------
XIX: Crusaders
-------
-------
XLIII: End of Failed Timeline
-------
-------
XLIV: strict proof eternal
-------
-------
XLV: I'd shut them all in cells.
-------
-------
XLVIII: aiat, aiat, aiat, aiat, aiat
-------
Total Fragments Found: 42
for everyone even though I have 46/50 fragments
paultravers commented
I see the issue. My list of grimoire entries I'm checking against is wrong. I've updated the list and it appears to be correct for me now. Also added support for api-key and a little bit of error handling on the first api call