Python msrestazure(0.4.20V)抛出以下错误:
credentials = UserPassCredentials(userid, password)
File "/data/tools/lib/python3.5/site-packages/msrestazure/azure_active_directory.py", line 367, in __init__
self.set_token()
File "/data/tools/lib/python3.5/site-packages/msrestazure/azure_active_directory.py", line 404, in set_token
raise_with_traceback(AuthenticationError, "", err)
File "/data/tools/lib/python3.5/site-packages/msrest/exceptions.py", line 45, in raise_with_traceback
raise error.with_traceback(exc_traceback)
File "/data/tools/lib/python3.5/site-packages/msrestazure/azure_active_directory.py", line 402, in set_token
**optional)
File "/data/tools/lib/python3.5/site-packages/requests_oauthlib/oauth2_session.py", line 221, in fetch_token
verify=verify, proxies=proxies)
File "/data/tools/lib/python3.5/site-packages/requests/sessions.py", line 555, in post
return self.request('POST', url, data=data, json=json, **kwargs)
File "/data/tools/lib/python3.5/site-packages/requests_oauthlib/oauth2_session.py", line 360, in request
headers=headers, data=data, **kwargs)
File "/data/tools/lib/python3.5/site-packages/requests/sessions.py", line 508, in request
resp = self.send(prep, **send_kwargs)
File "/data/tools/lib/python3.5/site-packages/requests/sessions.py", line 618, in send
r = adapter.send(request, **kwargs)
File "/data/tools/lib/python3.5/site-packages/requests/adapters.py", line 502, in send
raise ProxyError(e, request=request)
msrest.exceptions.AuthenticationError: , ProxyError: HTTPSConnectionPool(host='login.microsoftonline.com', port=443): Max retries exceeded with url: /common/oauth2/token (Caused by ProxyError('Cannot connect to proxy.', OSError('Tunnel connection failed: 403 Forbidden',)))
我们使用了正确的天蓝色凭据,知道吗?
编辑:
这个问题再次出现,这次是由于其他异常requests.exceptions.ProxyError: HTTPSConnectionPool(host='login.microsoftonline.com', port=443): Max retries exceeded with url: /common/UserRealm/username%40<dns>.onmicrosoft.com?api-version=1.0 (Caused by ProxyError('Cannot connect to proxy.', OSError('Tunnel connection failed: 403 Forbidden',)))