DarkCat09 / python-aternos

[UNMAINTAINED] Unofficial Aternos API written in Python
https://pypi.org/project/python-aternos/
Apache License 2.0
92 stars 13 forks source link

Updated Aternos internal API? #41

Closed didotb closed 2 years ago

didotb commented 2 years ago

I can't seem to list servers anymore after approximately July 25, 2022 : 09:00:00 AM list_servers() returns an empty list instead of a list of server objects Here's the debug from logging module

Python 3.8.10 (default, Jun  2 2021, 10:49:15)
[GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import logging
>>> logging.basicConfig(level=logging.DEBUG)
>>> from python_aternos import Client
>>> a = Client.from_credentials(REDACTED)
DEBUG:root:Requesting(GET)https://aternos.org/go/
DEBUG:root:headers={}
DEBUG:root:params={}
DEBUG:root:data={}
DEBUG:root:req-cookies={'ATERNOS_SESSION': ''}
DEBUG:root:session-cookies=<RequestsCookieJar[]>
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): aternos.org:443
DEBUG:urllib3.connectionpool:https://aternos.org:443 "GET /go/ HTTP/1.1" 200 None
DEBUG:root:AternosConnect received: <!DOCTYPE html>
<html>
    <head>
        <base href="/panel/"/>

INFO:root:GET completed with 200 status
DEBUG:root:Requesting(POST)https://aternos.org/panel/ajax/account/login.php
DEBUG:root:headers={'X-Requested-With': 'XMLHttpRequest'}
DEBUG:root:params={'TOKEN': REDACTED, 'SEC': REDACTED}
DEBUG:root:data={'user': REDACTED, 'password': REDACTED}
DEBUG:root:req-cookies={'ATERNOS_SESSION': ''}
DEBUG:root:session-cookies=<RequestsCookieJar[<Cookie ATERNOS_LANGUAGE=en for aternos.org/>, <Cookie ATERNOS_SEC_REDACTED for aternos.org/>]>
DEBUG:urllib3.connectionpool:https://aternos.org:443 "POST /panel/ajax/account/login.php?TOKEN=REDACTED&SEC=REDACTED HTTP/1.1" 200 None
DEBUG:root:AternosConnect received: {"success":true,"error":null,"message":null,"show2FA":false}
INFO:root:POST completed with 200 status
>>> s = a.list_servers()
DEBUG:root:Requesting(GET)https://aternos.org/servers/
DEBUG:root:headers={}
DEBUG:root:params={}
DEBUG:root:data={}
DEBUG:root:req-cookies={'ATERNOS_SESSION': REDACTED}
DEBUG:root:session-cookies=<RequestsCookieJar[<Cookie ATERNOS_LANGUAGE=en for aternos.org/>, <Cookie ATERNOS_SEC_REDACTED for aternos.org/>]>
DEBUG:urllib3.connectionpool:https://aternos.org:443 "GET /servers/ HTTP/1.1" 200 None
DEBUG:root:AternosConnect received: <!DOCTYPE html>
<html class="account-layout">
<head>
    <meta ch
INFO:root:GET completed with 200 status
>>> s
[]

I have confirmed that I have 2 different servers (see screenshot below) image

DarkCat09 commented 2 years ago

Hello.
It's a parsing bug, it was reported in #29
Fix was merged into the main branch, please, wait for the new release.

DarkCat09 commented 2 years ago

The issue will be closed after uploading new version to PyPI.

didotb commented 2 years ago

@DarkCat09 I however did not install from PyPI but cloned this repo and ran the setup.py instead. So the fix should be applied already. I have checked and sure enough it's been applied.

195        servers = serverstree.xpath(
196            '/html/body/div[1]/main/div[3]/section/div[1]/div[2]/div'
197            '/div[@class="server-body"]/@data-id'
198        )
DarkCat09 commented 2 years ago

@didotb, fixed. Update to v1.1.1 from pip.