title: How to Create API Signature with application/x-www-form-urlencoded
body: <p>First attempt at connecting to a Bitcoin exchange's private API and I am already stuck in trying to do a Test call with my code.</p>
  
  <pre><code>from urllib2 import Request, urlopen
  from urllib import urlencode
  import datetime
  
  api_key = "myAPIkey"
  api_secret = "mySercetKey"
  
  timestamp = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')
  values = urlencode({"timestamp" : timestamp})
  
  headers = {"Content-Type": "application/x-www-form-urlencoded", "key": api_key, "sig": api_secret}
  request = Request("https://www.fybsg.com/api/SGD/test", data=values, headers=headers)
  response_body = urlopen(request).read()
  print response_body
  </code></pre>
  
  <p>Here's what was returned from response_body:</p>
  
  <pre><code>{"error":"An unexpected error occurred, its probably your fault, go read the docs."}
  </code></pre>
  
  <p>Can a kind soul point out what's wrong with my code? (I've got a feeling it's seriously wrong)
  The API documentation for the bitcoin exchange can be found <a href="http://docs.fyb.apiary.io/" rel="nofollow">here</a>. (Test function)</p>