Login with your social network:
Python Script To Demonstrate Current Users API Usage
Sign up FREE & get 250 points
#!/usr/bin/python
import urllib
import urllib2
import time
import json
# Set the url to testimonials
url = "http://www.points2shop.com/webservice/currentusers"
# This key is required for all API REST calls and can be found in details of your application
p2s_api_key = 'c5a6ae5c570bb3bbb20fdba95b97174f3dbb3913'
# Initialize the request
request = urllib2.Request(url = url)
# Set key to header
request.add_header('X-Points2shop-Api-Key', p2s_api_key)
try:
# Make the request
result = urllib2.urlopen(request)
# decode the JSON
currentusers = json.loads(result.read())
for user in currentusers:
print user['username']
print user['honour_level']
print user['profile_url']
except urllib2.HTTPError, e:
print e.getcode()
print e.read()