coinbase / coinbase-python

DEPRECATED — Coinbase Python API
Apache License 2.0
528 stars 217 forks source link

No resource_path returned in API calls to resource collections. #83

Closed achampion closed 5 years ago

achampion commented 5 years ago

The response to /v2/accounts does not include a resource_path so the example in the documentation accounts.refresh() fails, e.g.:

In []:
from coinbase.wallet.client import Client
client = Client(<api-key>, <api-secret>, api_version='2017-08-07')
accounts = client.get_accounts()
accounts

Out[]:
<APIObject @ 0x1076bd888> {
  "data": [
    ...
  ]
} 

In []:
accounts.refresh()

Out[]:
...
ValueError: Unable to refresh: missing 'resource_path' attribute.

You can manually add a resource_path which allows the call to work:

In []:
accounts['resource_path'] = '/v2/accounts'
accounts.refresh()

Out[]:
<APIObject @ 0x1076cec50> {
  "data": [
    ...
  ]
} 

This seems to be true for other resource collections, e.g. account[0].get_transactions() has the same issue.

sds commented 5 years ago

Possible resolution in #85. Feel free to reopen if you're still having issues!