Can anyone tell me what I need to do to fix this, because it keeps coming back as 'invalid sign':
api_key = "my key"
api_secret = "my secret"
nonce = int(round(time.time()))-1493420495
while nonce > 1:
params = {"method":"getInfo",
"nonce": nonce}
params = urllib.urlencode(params)
H = hmac.new(api_secret, digestmod=hashlib.sha512)
H.update(params)
sign = H.hexdigest()
headers = {"Content-type": "application/x-www-form-urlencoded",
"Key":api_key,
"Sign":sign}
conn = httplib.HTTPSConnection("btc-e.com")
conn.request("POST", "/tapi", params, headers)
response = conn.getresponse()
print response.status, response.reason
print json.load(response)
>>60280181
oh this is easy you just made a syntax error
just give it a couple looks over OP and you'll spot it
>>60281763
I appreciate the confidence, but I'm not a programmer; I've just sorta been piecing my code together from examples I've found online. I'm willing to put in the effort, but could you at least give me a hint?
>>60280181
Userequests
Also use ['code] tags so that indentation is preserved so that we can see what is in the loop and what isn't. (Or just use pastebin)
>>60281844
>use requests
Help?
Also... How do I use code tags?
>>60281834
i was just troll u
>>60282049
Okay. Well, fuck...
I've searched online a few times and there seems to be a common thing where hashes in python will work 1-2% of the time (and therefore clearly isn't a coding error) but the rest of the time it just doesn't work. I don't know what to do.
>>60281909
type "" before and "" after the code
>>60281909Just put your code between
>>60282233
>>60282193like this?
4chan won't let me repost it the code with whitespace (conn error).
I bet this'll go through just find though.
Convert sign to a string from an integer.
" test "
>>60282733
>>60282709
Would that just besign = int(H.hexdigest())?
>>60282758
https://www.google.ca/search?q=python+convert+int+to+string
>>60282778
Okay, so...sign = str(H.hexdigest())
orapi_secret = str("my secret")?
>>60282865
Neither seem to make a difference. Still returns
200 OK
{u'success': 0, u'error': u'invalid sign'}