Created
June 26, 2011 22:38
-
-
Save andrewxhill/1048066 to your computer and use it in GitHub Desktop.
Commplish Bitcoin Awarding API
This file contains 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 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() | |
#name of your Project | |
#lowercase. spaces replaced with underscores | |
project_id = {YOUR-PROJECT-ID} #e.g. "mol" | |
#create a parameters object | |
params = { | |
'user': user, | |
'id': project_id, | |
'api_sig': api_sig | |
} | |
#create and send request | |
url = 'http://www.commplish.com/public/user/give-bitcoin' | |
data = urllib.urlencode(params) | |
request = urllib2.Request(url, data) | |
response = urllib2.urlopen(req) | |
output = response.read() | |
""" | |
responses will be in JSON. If successful, response.address will | |
be the address of the user you wish to award Bitcoin. If unsuccessful | |
or if your user hasn't registered a Bitcoin payment address with | |
Commplish, you can direct them to do so at | |
http://www.commplish.com/home#options | |
""" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment