JavaScript is required to use Bungie.net

Forums

originally posted in:BungieNetPlatform
originally posted in: Help with GetDestinyExplorerItems
Edited by JerkLine: 4/14/2015 1:36:35 AM
3
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

Posting in language:

 

Play nice. Take a minute to review our Code of Conduct before submitting your post. Cancel Edit Create Fireteam Post

  • running the above code i get an error data = json_response['Response']['data'] KeyError: 'Response' at a loss on how to resolve

    Posting in language:

     

    Play nice. Take a minute to review our Code of Conduct before submitting your post. Cancel Edit Create Fireteam Post

  • 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.

    Posting in language:

     

    Play nice. Take a minute to review our Code of Conduct before submitting your post. Cancel Edit Create Fireteam Post

  • 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.

    Posting in language:

     

    Play nice. Take a minute to review our Code of Conduct before submitting your post. Cancel Edit Create Fireteam Post

You are not allowed to view this content.
;
preload icon
preload icon
preload icon