【发布时间】:2021-06-21 13:05:39
【问题描述】:
我正在尝试添加多个范围,但似乎不是在 url 中添加空格,而是添加了 +。我不确定如何确保添加空间。我将范围存储在列表中。
CALLBACK_URL = 'https://localhost/callback'
CLIENT_SECRET = SETTINGS['client_secret']
CLIENT_SCOPES = ['esi-mail.organize_mail.v1 ', 'esi-mail.send_mail.v1 ', 'esi-assets.read_assets.v1 ',
'esi-characters.read_blueprints.v1 ', 'esi-assets.read_corporation_assets.v1 ',
'esi-corporations.read_blueprints.v1 ']
ENDPOINT = 'https://login.eveonline.com/oauth/authorize'
def oauth_session(client_id, client_secret, scopes):
client = OAuth2Session(client_id, client_secret, scope=scopes)
uri, state = client.create_authorization_url(ENDPOINT)
return uri, state
响应将以下内容显示为范围(为简洁起见,仅显示范围):
&scope=esi-mail.organize_mail.v1++esi-mail.send_mail.v1++esi-assets.read_assets.v1++esi-characters.read_blueprints.v1++esi-assets.read_corporation_assets.v1++esi-corporations.read_blueprints.v1+
是我使用了错误的数据结构,还是我遗漏了什么?
【问题讨论】: