Created
February 24, 2013 11:43
-
-
Save peterarnott/5023523 to your computer and use it in GitHub Desktop.
A python example of accessing the panda api.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
player = raw_input("Player: ") | |
payload = {"format": "json", "player": player, "closed": "false"} | |
url = "http://urlredacted.com/api/v1/ban/" | |
r = requests.get(url, params=payload) | |
total = r.json['meta']['total_count'] | |
if total == 0: | |
print player + " is not banned on this server!" | |
else: | |
i = 0 | |
for ban in r.json['objects']: | |
staff = r.json['objects'][i]['staff'] | |
b_id = r.json['objects'][i]['id'] | |
reason = r.json['objects'][i]['reason'] | |
print str(b_id) + ": " + player + " was banned by " + staff + " for reason #" + str(reason) | |
i += 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment