我已使用" data_read"成功授权了API连接。作为范围,但是我在将多个范围参数(" data_read"" data_write")传递到OAuth2Session()函数时遇到问题。
需要将多个范围的参数作为
传递到URL字符串中https://api.website.com/oauth20/authorize?response_type=code&client_id=123456&redirect_uri=https...&的范围= DATA_READ&安培;范围= data_write ...
我尝试过使用逗号分隔列表:
scope=["data_read", "data_write"]
导致:
https://api.website.com/oauth20/authorize?response_type=code&client_id=123456&redirect_uri=https...&的范围= DATA_READ + data_write
我还尝试在字典中传递范围列表:
dict_scope = {'scope':["data_read", "data_write"]}
导致错误:
ValueError: Invalid scope ({'scope': ['data_read', 'data_write']}), must be string, tuple, set, or list.
我在这里查看过请求文档:
http://docs.python-requests.org/en/master/user/quickstart/#passing-parameters-in-urls
这里:
http://requests-oauthlib.readthedocs.io/en/latest/api.html#oauth-2-0-session
这里有和OAuth2示例:
http://requests-oauthlib.readthedocs.io/en/latest/examples/examples.html#examples
非常感谢任何想法或建议