【发布时间】:2017-08-17 00:39:12
【问题描述】:
我正在使用 Dropbox 的 Python 扩展程序,但收到以下错误消息:
TypeError: 'OAuth2FlowNoRedirectResult' object is not iterable
这是目前为止的代码:
import dropbox
flow = dropbox.DropboxOAuth2FlowNoRedirect(app_key, app_secret)
# Have the user sign in and authorize this token
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 = input("Enter the authorization code here: ").strip()
# This will fail if the user enters an invalid authorization code
access_token, user_id = flow.finish(code)
f = open('Top Secret.jpg', 'rb')
response = client.put_file('Top Secret.jpg', f)
print ("uploaded:", response)
f.close()
f, metadata = client.get_file_and_metadata('/Top Secret.jpg')
out = open('Test.jpg', 'wb')
out.write(f.read())
out.close()
print (metadata)
出于显而易见的原因,我排除了应用密钥和应用秘密。
【问题讨论】: