requests ConnectionError
Closed this issue · 2 comments
bahkadomos commented
I tried to run this code:
from skpy import Skype
from skpy import SkypeAuthException
from skpy import SkypeContacts
username = '*******@outlook.com'
password = '******'
sk = Skype(username, password, 'C:/Path-To-Token/tokens-app')
"tokens-app" file is empty.
But I got this error:
Traceback (most recent call last):
File "test.py", line 8, in <module>
sk = Skype(username, password, 'C:/Users/Professional/Documents/GitHub/skype/tokens-app')
File "C:\Users\Professional\Documents\GitHub\skype\env\lib\site-packages\skpy\main.py", line 69, in __init__
self.conn.getSkypeToken()
File "C:\Users\Professional\Documents\GitHub\skype\env\lib\site-packages\skpy\conn.py", line 188, in inner
return method(*args, **kwargs)
File "C:\Users\Professional\Documents\GitHub\skype\env\lib\site-packages\skpy\conn.py", line 423, in soapLogin
self.getRegToken()
File "C:\Users\Professional\Documents\GitHub\skype\env\lib\site-packages\skpy\conn.py", line 478, in getRegToken
token, expiry, msgsHost, endpoint = SkypeRegistrationTokenProvider(self).auth(self.tokens["skype"])
File "C:\Users\Professional\Documents\GitHub\skype\env\lib\site-packages\skpy\conn.py", line 918, in auth
endpointResp = self.conn("POST", "{0}/users/ME/endpoints".format(msgsHost), codes=(200, 201, 404),
File "C:\Users\Professional\Documents\GitHub\skype\env\lib\site-packages\skpy\conn.py", line 226, in __call__
resp = self.sess.request(method, url, headers=headers, **kwargs)
File "C:\Users\Professional\Documents\GitHub\skype\env\lib\site-packages\requests\sessions.py", line 475, in request
resp = self.send(prep, **send_kwargs)
File "C:\Users\Professional\Documents\GitHub\skype\env\lib\site-packages\requests\sessions.py", line 585, in send
r = adapter.send(request, **kwargs)
File "C:\Users\Professional\Documents\GitHub\skype\env\lib\site-packages\requests\adapters.py", line 467, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='client-s.gateway.messenger.live.com', port=443): Max retries exceeded with url: /v1/users/ME/endpoints (Caused by NewConnectionError('<requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x036BD9A0>: Failed to establish a new connection: [Errno 11004] getaddrinfo failed'))
I thought that the problem was in the requests version and ran the script from under the local environment, but the problem remained. There is env's freeze:
beautifulsoup4==4.9.3
requests==2.10.0
responses==0.12.0
six==1.15.0
SkPy==0.10.1
soupsieve==2.0.1
urllib3==1.25.11
Python 3.8.5
Terrance commented
If urllib can't make a successful connection then the problem is outside of SkPy -- either Skype was having issues at the time, or there's a problem with your network setup.
I note that client-s.gateway.messenger.live.com
has no IPv6 records -- are you using a v6-only connection, either direct or via a v6-only proxy?
bahkadomos commented
The problem was in the hosts file, microsoft domains were blocked in it. Excuse for troubling.