Skip to content

Instantly share code, notes, and snippets.

@peterarnott
Created February 24, 2013 11:43
Show Gist options
  • Save peterarnott/5023523 to your computer and use it in GitHub Desktop.
Save peterarnott/5023523 to your computer and use it in GitHub Desktop.
A python example of accessing the panda api.
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