pip install oauth2 python from oauth2 import Client client = Client( client_id='YOUR_CLIENT_ID', client_secret='YOUR_CLIENT_SECRET', auth_url='AUTHORIZATION_URL', token_url='TOKEN_URL' ) python redirect_uri = 'YOUR_REDIRECT_URI' scope = 'SCOPE' auth_url = client.auth_url(redirect_uri=redirect_uri, scope=scope) python authorization_code = 'YOUR_AUTHORIZATION_CODE' access_token = client.exchange_code(authorization_code, redirect_uri=redirect_uri) python resource_url = 'YOUR_RESOURCE_URL' headers = {'Authorization': 'Bearer ' + access_token} response = requests.get(resource_url, headers=headers)


上一篇:
下一篇:
切换中文