Author

Topic: [Solved] Help with Bitstamp API (Read 4301 times)

hero member
Activity: 547
Merit: 500
Decor in numeris
October 09, 2012, 08:04:30 AM
#5
Problem solved.  I was missing a / at the end of the URL.  I guess the error message was kind of misleading Smiley
BCB
vip
Activity: 1078
Merit: 1002
BCJ
October 08, 2012, 11:47:07 AM
#4
I'm using PHP and when I send a GET request I get the same error you are showing, but when I send a post request it work.

Try removing urlencode
hero member
Activity: 547
Merit: 500
Decor in numeris
October 08, 2012, 11:45:18 AM
#3
I'm going to guess you are sending a GET request and not a POST request ??

No, Python's library use a POST when there are parameters (it is also possibly to use a GET, but then you need to append the parameters to the url yourself).  At least, that is what the docs say, but I am not sure if I can test it.
BCB
vip
Activity: 1078
Merit: 1002
BCJ
October 08, 2012, 11:18:41 AM
#2
I'm going to guess you are sending a GET request and not a POST request ??
hero member
Activity: 547
Merit: 500
Decor in numeris
October 08, 2012, 10:49:12 AM
#1
Hi!

I am trying to use the Bitstamp API, but it apparently refuses to recognize my userid and password.   I have enabled API access in the settings, and I tried disabling 2-factor authentication to no avail.

I am using this Python script, can anyone help me find the problem?
Code:
import urllib2
from urllib import urlencode
import json

user="12345"
passwd="top-secret"

req = {}
req['user'] = user
req['password'] = passwd
post_data = urlencode(req)
print post_data
res = urllib2.urlopen("https://www.bitstamp.net/api/balance", post_data)
result = json.load(res)
print result

I get this results (sorry for the primitive formatting)
Code:
password=top-secret&user=12345
{u'error': u'Missing user and/or password POST parameters'}
(of course these are not my real userid and password, I get the same error with the real ones).

EDIT: Problem solved, se my post at the end.
Jump to: