dropbox.rest.ErrorResponse:[400] u'invalid_client'dropbox api fom python

时间:2015-05-01 18:17:05

标签: python dropbox

按照python api的教程我得到了这个错误

Traceback (most recent call last):
  File "/home/user/PycharmProjects/api/apid.py", line 17, in <module>
    access_token, user_id = flow.finish(code)
  File "/usr/local/lib/python2.7/dist-packages/dropbox/client.py", line 1398, in finish
    return self._finish(code, None)
  File "/usr/local/lib/python2.7/dist-packages/dropbox/client.py", line 1265, in _finish
    response = self.rest_client.POST(url, params=params)
  File "/usr/local/lib/python2.7/dist-packages/dropbox/rest.py", line 316, in POST
    return cls.IMPL.POST(*n, **kw)
  File "/usr/local/lib/python2.7/dist-packages/dropbox/rest.py", line 254, in POST
    post_params=params, headers=headers, raw_response=raw_response)
  File "/usr/local/lib/python2.7/dist-packages/dropbox/rest.py", line 227, in request
    raise ErrorResponse(r, r.read())
dropbox.rest.ErrorResponse: [400] u'invalid_client'

代码与教程相同

#!/usr/bin/env python

import dropbox

app_key = 'key'
app_secret = 'secret'

flow = dropbox.client.DropboxOAuth2FlowNoRedirect(app_key, app_secret)

authorize_url = flow.start()
print '1. Go to: ' + authorize_url
print '2. Click "Allow" (you might have to log in first)'
print '3. Copy the authorization code.'
code = raw_input("Enter the authorization code here: ").strip()

access_token, user_id = flow.finish(code)
client = dropbox.client.DropboxClient(access_token)
print 'linked account: ', client.account_info()

我没有改变原始代码中的任何内容

0 个答案:

没有答案