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

SOAP Login has stopped working #270

Closed LuigiBrito closed 1 month ago

LuigiBrito commented 1 month ago

Before we start...

Summary

Connecting with the simple sk = Skype('username', 'somepassword') just stopped working. I have tried to login to skype online, it works just fine. But this simple code just stopped working. (It has worked for years btw, same user, same pass, same everything)

Code sample

import logging
from skpy import Skype
import sys

sk = Skype('user@email.com', 'somepass')

sys.exit(0)

Code output

{'data': '\n'
         "    <Envelope xmlns='http://schemas.xmlsoap.org/soap/envelope/'\n"
         "       xmlns:wsse='http://schemas.xmlsoap.org/ws/2003/06/secext'\n"
         "       xmlns:wsp='http://schemas.xmlsoap.org/ws/2002/12/policy'\n"
         "       xmlns:wsa='http://schemas.xmlsoap.org/ws/2004/03/addressing'\n"
         "       xmlns:wst='http://schemas.xmlsoap.org/ws/2004/04/trust'\n"
         '       '
         "xmlns:ps='http://schemas.microsoft.com/Passport/SoapServices/PPCRL'>\n"
         '       <Header>\n'
         '           <wsse:Security>\n'
         "               <wsse:UsernameToken Id='user'>\n"
         '                   '
         '<wsse:Username>user@email.com</wsse:Username>\n'
         '                   '
         '<wsse:Password>somepass</wsse:Password>\n'
         '               </wsse:UsernameToken>\n'
         '           </wsse:Security>\n'
         '       </Header>\n'
         '       <Body>\n'
         "           <ps:RequestMultipleSecurityTokens Id='RSTS'>\n"
         "               <wst:RequestSecurityToken Id='RST0'>\n"
         '                   '
         '<wst:RequestType>http://schemas.xmlsoap.org/ws/2004/04/security/trust/Issue</wst:RequestType>\n'
         '                   <wsp:AppliesTo>\n'
         '                       <wsa:EndpointReference>\n'
         '                           <wsa:Address>wl.skype.com</wsa:Address>\n'
         '                       </wsa:EndpointReference>\n'
         '                   </wsp:AppliesTo>\n'
         '                   <wsse:PolicyReference '
         "URI='MBI_SSL'></wsse:PolicyReference>\n"
         '               </wst:RequestSecurityToken>\n'
         '           </ps:RequestMultipleSecurityTokens>\n'
         '       </Body>\n'
         '    </Envelope>\n'
         '    ',
 'headers': {}}
=> [16/08 23:08:49] 429
{'Content-Length': '17',
 'Content-Type': 'text/HTML',
 'Date': 'Fri, 16 Aug 2024 15:08:48 GMT',
 'Retry-After': '60',
 'client-request-id': '625890d9-d69b-47b2-aca3-e5692deabce3'}
Too Many Requests
Traceback (most recent call last):
  File "C:\Users\Luigi PC\PycharmProjects\SkypeMessenger\venv\lib\site-packages\skpy\main.py", line 67, in __init__
    self.conn.readToken()
  File "C:\Users\Luigi PC\PycharmProjects\SkypeMessenger\venv\lib\site-packages\skpy\conn.py", line 336, 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 "C:\Program Files\JetBrains\PyCharm Community Edition 2023.2\plugins\python-ce\helpers\pydev\pydevd.py", line 1500, in _exec
    pydev_imports.execfile(file, globals, locals)  # execute the script
  File "C:\Program Files\JetBrains\PyCharm Community Edition 2023.2\plugins\python-ce\helpers\pydev\_pydev_imps\_pydev_execfile.py", line 18, in execfile
    exec(compile(contents+"\n", file, 'exec'), glob, loc)
  File "C:\Users\Luigi PC\PycharmProjects\SkypeMessenger\TestSkype.py", line 8, in <module>
    sk = Skype('user@email.com', 'somepass')
  File "C:\Users\Luigi PC\PycharmProjects\SkypeMessenger\venv\lib\site-packages\skpy\main.py", line 69, in __init__
    self.conn.getSkypeToken()
  File "C:\Users\Luigi PC\PycharmProjects\SkypeMessenger\venv\lib\site-packages\skpy\conn.py", line 196, in inner
    return method(*args, **kwargs)
  File "C:\Users\Luigi PC\PycharmProjects\SkypeMessenger\venv\lib\site-packages\skpy\conn.py", line 462, in soapLogin
    self.tokens["skype"], self.tokenExpiry["skype"] = SkypeSOAPAuthProvider(self).auth(user, pwd)
  File "C:\Users\Luigi PC\PycharmProjects\SkypeMessenger\venv\lib\site-packages\skpy\conn.py", line 783, in auth
    token = self.getSecToken(user, pwd)
  File "C:\Users\Luigi PC\PycharmProjects\SkypeMessenger\venv\lib\site-packages\skpy\conn.py", line 787, in getSecToken
    loginResp = self.conn("POST", "{0}/RST.srf".format(SkypeConnection.API_MSACC),
  File "C:\Users\Luigi PC\PycharmProjects\SkypeMessenger\venv\lib\site-packages\skpy\conn.py", line 248, in __call__
    raise SkypeAuthException("Auth rate limit exceeded", resp)
skpy.core.SkypeAuthException: ('Auth rate limit exceeded', <Response [429]>)

Explain your code

It just tries to login. That's all.

SkPy version

0.10.7

Python version

3.10.4

Anything else?

No response

Terrance commented 1 month ago
  • [x] I've read the documentation (including notes on error messages and rate limiting), but my problem is something else.

As the exception says, you've been rate-limited during login. If you're logging in frequently, do that less often or use the token file to avoid repeat authentications.

Note that Skype may have recently tightened some limits, which is outside of SkPy's control.