Thread
:
State of Maemo Money Transfer Apps
View Single Post
biketool
2012-08-10 , 11:06
Posts: 1,432 | Thanked: 2,630 times | Joined on Jan 2011 @ Touring
#
4
the API
https://en.bitcoin.it/wiki/MtGox/API
here is the python to plug mtgox
from urllib import urlencode
import urllib2
import time
from hashlib import sha512
from hmac import HMAC
import base64
import json
def get_nonce():
return int(time.time()*100000)
def sign_data(secret, data):
return base64.b64encode(str(HMAC(secret, data, sha512).digest()))
class requester:
def __init__(self, auth_key, auth_secret):
self.auth_key = auth_key
self.auth_secret = base64.b64decode(auth_secret)
def build_query(self, req={}):
req["nonce"] = get_nonce()
post_data = urlencode(req)
headers = {}
headers["User-Agent"] = "GoxApi"
headers["Rest-Key"] = self.auth_key
headers["Rest-Sign"] = sign_data(self.auth_secret, post_data)
return (post_data, headers)
def perform(self, path, args):
data, headers = self.build_query(args)
req = urllib2.Request("https://mtgox.com/api/0/"+path, data, headers)
res = urllib2.urlopen(req, data)
return json.load(res)
Last edited by biketool; 2012-08-10 at
11:25
.
Quote & Reply
|
biketool
View Public Profile
Send a private message to biketool
Find all posts by biketool