Terrance / SkPy

An unofficial Python library for interacting with the Skype HTTP API.
https://skpy.t.allofti.me
BSD 3-Clause "New" or "Revised" License
263 stars 66 forks source link

unknown reason for error during Skype(input("Username: "), getpass("Password: ")) #257

Closed skylimit42 closed 7 months ago

skylimit42 commented 7 months ago

Hi

I am new to python and new to skpy i am trying to do the first step to connect to my account, below is my code


from skpy import Skype sk = Skype() Skype(input("Username: "), getpass("Password: ")) if sk.conn.connected: print("Skype connection is successfully logged in") else: print("Skype connection failed")

below were the test results which i have tested several different way, but still are not able to get the connection correct for skype, i hope someone can guide me through it

  1. if i use my correct email address and a password when it prompt me to enter, after i enter password, the console close and display Console Closed

  2. if i use my correct email address and a incorrect password when it prompt me to enter, it display the following _Traceback (most recent call last): File "/home/skypaysolution/.local/lib/python3.10/site-packages/skpy/main.py", line 67, in init self.conn.readToken() File "/home/skypaysolution/.local/lib/python3.10/site-packages/skpy/conn.py", line 305, in readToken raise SkypeAuthException("No token file specified") skpy.core.SkypeAuthException: No token file specified

During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/skypaysolution/skypemsg.py", line 13, in Skype(input("Username: "), getpass("Password: ")) File "/home/skypaysolution/.local/lib/python3.10/site-packages/skpy/main.py", line 69, in init self.conn.getSkypeToken() File "/home/skypaysolution/.local/lib/python3.10/site-packages/skpy/conn.py", line 196, in inner return method(*args, **kwargs) File "/home/skypaysolution/.local/lib/python3.10/site-packages/skpy/conn.py", line 434, in soapLogin self.tokens["skype"], self.tokenExpiry["skype"] = SkypeSOAPAuthProvider(self).auth(user, pwd) File "/home/skypaysolution/.local/lib/python3.10/site-packages/skpy/conn.py", line 755, in auth token = self.getSecToken(user, pwd) File "/home/skypaysolution/.local/lib/python3.10/site-packages/skpy/conn.py", line 774, in getSecToken raise SkypeAuthException("{} - {}".format(code, msg), loginResp) skpy.core.SkypeAuthException: ('wsse:FailedAuthentication - Authentication Failure', <Response [200]>)_

  1. if i use a telephone number and correct password, it will display the following _Traceback (most recent call last): File "/home/skypaysolution/.local/lib/python3.10/site-packages/skpy/main.py", line 67, in init self.conn.readToken() File "/home/skypaysolution/.local/lib/python3.10/site-packages/skpy/conn.py", line 305, in readToken raise SkypeAuthException("No token file specified") skpy.core.SkypeAuthException: No token file specified

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/local/lib/python3.10/site-packages/urllib3/connectionpool.py", line 700, in urlopen self._prepare_proxy(conn) File "/usr/local/lib/python3.10/site-packages/urllib3/connectionpool.py", line 994, in _prepare_proxy conn.connect() File "/usr/local/lib/python3.10/site-packages/urllib3/connection.py", line 369, in connect self._tunnel() File "/usr/local/lib/python3.10/http/client.py", line 924, in _tunnel raise OSError(f"Tunnel connection failed: {code} {message.strip()}") OSError: Tunnel connection failed: 403 Forbidden

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/local/lib/python3.10/site-packages/requests/adapters.py", line 489, in send resp = conn.urlopen( File "/usr/local/lib/python3.10/site-packages/urllib3/connectionpool.py", line 785, in urlopen retries = retries.increment( File "/usr/local/lib/python3.10/site-packages/urllib3/util/retry.py", line 592, in increment raise MaxRetryError(_pool, url, error or ResponseError(cause)) urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='login.skype.com', port=443): Max retries exceeded with url: /login/oauth/microsoft?client_id=578134&redirect_uri=https%3A%2F%2Fweb.skype.com (Caused by ProxyError('Cannot connect to proxy.', OSError('Tunnel connection failed: 403 Forbidden')))

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/home/skypaysolution/skypemsg.py", line 13, in Skype(input("Username: "), getpass("Password: ")) File "/home/skypaysolution/.local/lib/python3.10/site-packages/skpy/main.py", line 69, in init self.conn.getSkypeToken() File "/home/skypaysolution/.local/lib/python3.10/site-packages/skpy/conn.py", line 196, in inner return method(*args, kwargs) File "/home/skypaysolution/.local/lib/python3.10/site-packages/skpy/conn.py", line 407, in liveLogin self.tokens["skype"], self.tokenExpiry["skype"] = SkypeLiveAuthProvider(self).auth(user, pwd) File "/home/skypaysolution/.local/lib/python3.10/site-packages/skpy/conn.py", line 617, in auth self.getT(user, pwd) File "/home/skypaysolution/.local/lib/python3.10/site-packages/skpy/conn.py", line 646, in getT stage1Resp = self.check(self.conn("GET", "{0}/oauth/microsoft".format(SkypeConnection.API_LOGIN), File "/home/skypaysolution/.local/lib/python3.10/site-packages/skpy/conn.py", line 238, in call resp = self.sess.request(method, url, headers=headers, kwargs) File "/usr/local/lib/python3.10/site-packages/requests/sessions.py", line 587, in request resp = self.send(prep, send_kwargs) File "/usr/local/lib/python3.10/site-packages/requests/sessions.py", line 701, in send r = adapter.send(request, kwargs) File "/usr/local/lib/python3.10/site-packages/requests/adapters.py", line 559, in send raise ProxyError(e, request=request) requests.exceptions.ProxyError: HTTPSConnectionPool(host='login.skype.com', port=443): Max retries exceeded with url: /login/oauth/micr osoft?client_id=578134&redirecturi=https%3A%2F%2Fweb.skype.com (Caused by ProxyError('Cannot connect to proxy.', OSError('Tunnel conne ction failed: 403 Forbidden')))

  1. i also tried the following code sk.conn.soapLogin(input("Username: "), getpass("Password: ")) the result is same as 1, 2 above

Hope someone can help me

Terrance commented 7 months ago

This isn't the place for general programming or Python assistance -- consider communities like /r/LearnPython or Python Discord instead.

The authentication error you're seeing is working as expected and documented. Your console closing with the correct password is presumably because your program is running to completion and exiting.

The proxy error is presumably because you're behind a proxy that isn't functioning correctly -- if you've configured SkPy or your environment to use a proxy, try turning it off; if you don't think you're using one, it may be at a layer above you. In any case, this isn't a problem with SkPy but with the internet connection it's using.