Response Content: {"message":"Must specify a 'request' field in the payload that matches the URL path."}
url = 'https://bitfinex.com/api/v1/balances' payloadObject = { 'request':'/api/v1/balances', 'nonce':time.time(), 'options':{} } payload_json = json.dumps(payloadObject) #print payload_json payload = str(base64.b64encode(payload_json)) #print payload api_secret="..." api_key="..." m=hmac.new(api_secret, payload, hashlib.sha384) signature=m.hexdigest() print signature headers = { 'X-BFX-APIKEY' : api_key, 'X-BFX-PAYLOAD' : base64.b64encode(payload_json), 'X-BFX-SIGNATURE' : signature } r = requests.get(url, data={}, headers=headers) print 'Response Code: ' + str(r.status_code) print 'Response Header: ' + str(r.headers) print 'Response Content: '+ str(r.content)
url = 'https://api.bitfinex.com/v1/balances' payloadObject = { 'request':'/v1/balances', 'nonce':str(long(time.time() * 100000)), 'options':{} } payload_json = json.dumps(payloadObject) #print payload_json payload = str(base64.b64encode(payload_json)) #print payload api_secret="..." api_key=".." m=hmac.new(api_secret, payload, hashlib.sha384) signature=m.hexdigest() print signature headers = { 'X-BFX-APIKEY' : api_key, 'X-BFX-PAYLOAD' : base64.b64encode(payload_json), 'X-BFX-SIGNATURE' : signature } r = requests.get(url, data={}, headers=headers) print 'Response Code: ' + str(r.status_code) print 'Response Header: ' + str(r.headers) print 'Response Content: '+ str(r.content)
api_key = 'some key'api_secret = 'some secret'api_url = 'https://api.bitfinex.com/v1'def Balances(): nonce = str(long(time.time() * 100000)) payloadObject = { 'request':'/balances', 'nonce': nonce, 'options':{} } payload_json = json.dumps(payloadObject) payload = str(base64.b64encode(payload_json)) parms = urllib.urlencode(payloadObject) signature = hmac.new(api_secret, parms, hashlib.sha384).hexdigest() headers = {"X-BFX-APIKEY": api_key, 'X-BFX-PAYLOAD': payload, "X-BFX-SIGNATURE": signature, } public = urllib2.urlopen(urllib2.Request(api_url + '/balances', headers)) balances = json.load(public) return balances