originally posted in:BungieNetPlatform
You can construct a query in the url, like: [url]https://www.bungie.net/Platform/Destiny/Explorer/Items/?count=100&page=0[/url] and then increment the page. A simple Python script with the python-requests library would look something like:
[quote]
import requests
weapon_list = []
params = {
'buckets': ['PrimaryWeapon', 'SpecialWeapon', 'HeavyWeapon'],
'count': 100,
'page': 0
}
json_response = requests.get('https://www.bungie.net/Platform/Destiny/Explorer/Items/', params=params).json()
data = json_response['Response']['data']
weapon_list += data['itemHashes']
while data['hasMore']:
params['page'] += 1
json_response = requests.get('https://www.bungie.net/Platform/Destiny/Explorer/Items/', params=params).json()
data = json_response['Response']['data']
weapon_list += data['itemHashes']
[/quote]
Forgive the awful formatting. Also, I don't know what the rate limits are and I didn't account for it in that script. Also I assume the item hashes are what you want.
English
-
running the above code i get an error data = json_response['Response']['data'] KeyError: 'Response' at a loss on how to resolve
-
I definitely wrote that without running it or even consulting documentation. Glancing at it I think if you remove `data = json_response['Response']['data']` and just use the json_response you should be fine. See http://docs.python-requests.org/en/master/ for the proper usage.
-
What I wanted are the stats for the items, but thanks with the code you provided I think I will be able to figure out the rest. I tried using the types parameter to sort for weapons and armor, but every time I sent a request I would get a syntax error.