2017-08-17 75 views
-1

我使用Dropbox的Python扩展和我收到此错误信息:什么类型错误:“OAuth2FlowNoRedirectResult”的对象是可迭代并不意味着

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) 

我明显的原因排除了应用程序密钥和应用程序秘密。

回答

0

修改的下列代码行如下 -

access_token,user_id= flow.finish(code) 

access_token= flow.finish(code) 

flow.finish

方法不返回的元组。它返回一个单一的对象。

相关问题