Skip to content

Instantly share code, notes, and snippets.

@andrewxhill
Created June 23, 2011 03:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andrewxhill/1041841 to your computer and use it in GitHub Desktop.
Save andrewxhill/1041841 to your computer and use it in GitHub Desktop.
Python Commplish User Profile API Example
import md5
import urllib
import urllib2
#the API Secret for your Project
secret = '9393c2df-e1c8-457c-adc1-a5b75210d52f'
#the User email address you querying (all lowercase)
email = 'andrewxhill@gmail.com'
#concatenate the two parameters
sig_string = secret + email
#create md5 hash
m = md5.new()
m.update(sig_string)
#the API Signature
api_sig = m.hexdigest()
#create an md5 of the user email
u = md5.new()
u.update(email)
user = m.hexdigest()
#create a parameters object
params = {
'user': user,
'id': {YOUR_PROJECT_ID},
'api_sig': api_sig,
}
#create and send request
url = 'http://www.commplish.com/public/user/profile'
data = urllib.urlencode(params)
request = urllib2.Request(url, data)
response = urllib2.urlopen(req)
output = response.read()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment