JavaScript is required to use Bungie.net

Group Avatar

BungieNetPlatform

"Updates, discussions, and documentation of the BungieNetPlatform API."

Request Join
originally posted in:BungieNetPlatform
Edited by RUEric: 1/8/2016 7:00:50 AM
1

Python Examples

Hello All, Looking to get into learning/developing python code using this API so please excuse me for my silly questions Would anyone mind sharing some basic Python examples so I can look through and try and follow along? I've researched a bit on how to use the API key.. But still fuzzy on how these end-points work and how to make proper GET calls using the public API's listed in Tetron's above post.. So far, I've tried following along the example posted that tries this: Python 2.7.10 >>> import urllib2 >>> import json >>> foo = urllib2.Request('http://www.bungie.net/Platform/Destiny/2/Stats/GetMembershipIdByDisplayName/Rueric/', headers={ 'X-API-Key' : 'secret'}) >>> str = urllib2.urlopen(foo).read().decode('utf-8') >>> str u'{"Response":"0","ErrorCode":217,"ThrottleSeconds":0,"ErrorStatus":"UserCannotResolveCentralAccount","Message":"We\'ve encountered an error, please try again later.","MessageData":{}}' Any suggestions? Thank you

Posting in language:

 

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

  • I have literally started exploring the API yesterday. I have some plans for an app/website that will be built around the entire suite of the destiny API (there's so much to do!!) but I pretty much managed to successfully validate my setup and access to the API using the below tiny snippet:- Note: This is still a WIP code and you'll see things that look unfinished below. You can pretty much use this as your base and add more endpoints around it. https://www.bungie.net/platform/destiny/help/ is the eventual goal. import requests import json from requests.auth import HTTPProxyAuth strURL = 'http://www.bungie.net/Platform/User/SearchUsers/?q=' strQuery = '' __RequestHeaders = {"X-API-Key" : 'INSERT YOUR API KEY HERE'} webResponse = requests.get(strURL, headers = __RequestHeaders) print json.loads(webResponse)

    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