I'm trying to write a simple script to validate that I am making an API call correctly, and then I plan to build out a more complex program from there. The error response I am receiving is:

```
{"error":"Invalid API key\/secret pair."}

```

The API documentation for what I'm working on can be found at:

<https://poloniex.com/support/api/>

I've just been incrementing the nonce manually to keep things simple.

My code is:

```
import urllib
import urllib2
import json
import time
import hmac,hashlib

APIKey = "<my_API_key>"
Secret = "<my_secret>"
post_request
"command=returnBalances"
sign = hmac.new(Secret, post_request, hashlib.sha512).hexdigest()

ret = urllib2.urlopen(urllib2.Request("https://poloniex.com/tradingApi?   key=" + APIKey + "&sign=" + sign + "&nonce=0008"))

print ret.read()

```