lionheart / python-harvest

A Python wrapper for the Harvest time-tracking API.
Apache License 2.0
55 stars 49 forks source link

Missing access token error #29

Closed drcongo closed 5 years ago

drcongo commented 7 years ago

I've got an OAuth setup going, but whenever I try to do anything on the Harvest client object I get an error...

----> 1 h.who_am_i

/vagrant/venv/local/lib/python2.7/site-packages/harvest/harvest.pyc in who_am_i(self)
     73     @property
     74     def who_am_i(self):
---> 75         return self._get('/account/who_am_i')
     76
     77     ## Client Contacts

/vagrant/venv/local/lib/python2.7/site-packages/harvest/harvest.pyc in _get(self, path, data)
    308
    309     def _get(self, path='/', data=None):
--> 310         return self._request('GET', path, data)
    311
    312     def _post(self, path='/', data=None):

/vagrant/venv/local/lib/python2.7/site-packages/harvest/harvest.pyc in _request(self, method, path, data)
    354             return resp
    355         except Exception, e:
--> 356             raise HarvestError(e)
    357
    358
HarvestError: Missing access token.

The token is in place correctly, and it's still valid (only just created).

In [12]: h.token
Out[12]: u'[A VALID TOKEN HERE]'

In [13]: h.uri
Out[13]: 'https://api.harvestapp.com'

In [14]: h.client_id
Out[14]: '[CORRECT CLIENT ID HERE]'

The client is created with h = harvest.Harvest(url, client_id=client_id, token=token)

Any ideas?

Brad-eki commented 5 years ago

@drcongo I don't know if this is still important to you, but there's a beta release for a new version of python-harvest. It is not backwards compatible. It supports Harvest API v2 and the new authorization paradigm.

Brad-eki commented 5 years ago

There has been a beta release of python-harvest 5.0 which has implemented support specifically for OAuth2.