sonph / gdaxcli

Commandline client for trading on GDAX.
MIT License
4 stars 2 forks source link

Handle errors from gdax-python #17

Open sonph opened 7 years ago

sonph commented 7 years ago

The library has pretty poor exception handling, so we'll need to check the json output before processing it.

sonph commented 7 years ago

When API keys are invalid, we'll get

[{u'message': u'Invalid API Key'}] or [{u'message': u'Invalid Passphrase'}] or

  File "/Users/sonph/.local/share/virtualenvs/gdaxcli/lib/python2.7/site-packages/requests/sessions.py", line 488, in request
    prep = self.prepare_request(req)
  File "/Users/sonph/.local/share/virtualenvs/gdaxcli/lib/python2.7/site-packages/requests/sessions.py", line 431, in prepare_request
    hooks=merge_hooks(request.hooks, self.hooks),
  File "/Users/sonph/.local/share/virtualenvs/gdaxcli/lib/python2.7/site-packages/requests/models.py", line 309, in prepare
    self.prepare_auth(auth, url)
  File "/Users/sonph/.local/share/virtualenvs/gdaxcli/lib/python2.7/site-packages/requests/models.py", line 540, in prepare_auth
    r = auth(self)
  File "/Users/sonph/.local/share/virtualenvs/gdaxcli/lib/python2.7/site-packages/gdax/authenticated_client.py", line 298, in __call__
    hmac_key = base64.b64decode(self.secret_key)
  File "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/base64.py", line 78, in b64decode
    raise TypeError(msg)
TypeError: Incorrect padding