PhotonQuantum / pysjtu

The Python iSJTU client for Humans.
https://pysjtu.readthedocs.io/en/latest/
GNU General Public License v3.0
44 stars 3 forks source link

Login issues #12

Open yuuuiv opened 5 months ago

yuuuiv commented 5 months ago

When I try to login, it seems like the uuid cannot be defined correctly. Login with username and password: 7ef0934821682a94f2d40a6eaaf1d0c2 Login with cookies: 221f6bce1bff548659dc92316d76f8bf By the way, could you please tell me which one between JSESSIONID and kc@i.sjtu.edu.cn is the one that contains session info? As I'm a freshman, I might need your further help...tks

Lijilai-1024 commented 5 months ago

I met the same problem.

PhotonQuantum commented 5 months ago

Fixed in v0.4.2.

Regarding your question, I believe that both 'JSESSIONID' and ''`kc@i.sjtu.edu.cn' are involved in the authorization process.

lan-qing commented 6 days ago

I met the same problem in v0.4.2.

lan-qing commented 6 days ago

I met the same problem in v0.4.2.

It seems I solve it by setting validate_session=False again.

PhotonQuantum commented 4 days ago

@lan-qing Could you please provide more information? By setting validate_session to false, you lose the auto login function when the session expires.

lan-qing commented 3 days ago

@lan-qing Could you please provide more information? By setting validate_session to false, you lose the auto login function when the session expires.

Dear PhotonQuantum,

Thanks for your reply. I installed pysjtu in a new python environment just now and met the same problem again. Here is the error message:

[Clang 13.0.1 ] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import pysjtu
>>> c = pysjtu.create_client(username="xxx", password="xxx")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "xxx/miniforge3/lib/python3.9/site-packages/pysjtu/client/__init__.py", line 71, in create_client
    sess = Session(*args, **kwargs)
  File "xxx/miniforge3/lib/python3.9/site-packages/pysjtu/session.py", line 122, in __init__
    self.loads({"username": username, "password": password})
  File "xxx/miniforge3/lib/python3.9/site-packages/pysjtu/session.py", line 429, in loads
    self.login(self._username, self._password)
  File "xxx/miniforge3/lib/python3.9/site-packages/pysjtu/session.py", line 368, in login
    result = self._secure_req(
  File "xxx/lib/python3.9/site-packages/pysjtu/session.py", line 85, in _secure_req
    return ref()
  File "xxx/miniforge3/lib/python3.9/site-packages/pysjtu/session.py", line 264, in post
    return self.request(
  File "xxx/miniforge3/lib/python3.9/site-packages/pysjtu/session.py", line 161, in request
    self.login(self._username, self._password)
  File "xxx/miniforge3/lib/python3.9/site-packages/pysjtu/session.py", line 359, in login
    uuid = re.findall(r"(?<=uuid=).*(?=\")", login_page_req.text)[0]
IndexError: list index out of range
>>> pysjtu.__version__
'0.4.2'

Is this sufficient to identify the problem? If anything more is helpful, I would be happy to provide it.