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

503 Service unavaliable #88

Closed TechDudie closed 1 year ago

TechDudie commented 1 year ago

I am currently writing a discord bot to start our SMP. At first, my code, freshly copied from an example, refused to work, saying

Traceback (most recent call last):
  File "c:\Users\TechnoDot\Desktop\VSCode\TechnoBot\utils.py", line 92, in <module>
    aternos = Client()
              ^^^^^^^^
TypeError: Client.__init__() missing 1 required positional argument: 'atconn'

I did some digging, stuck in an AternosConnect() class as a param. Then, .login() would not work, did some more digging, used .from_credentials() instead (probably should update your examples to save the time and effort for other people). Now, I get the error shown in the title:

Traceback (most recent call last):
  File "c:\Users\TechnoDot\Desktop\VSCode\TechnoBot\main.py", line 6, in <module>
    import utils
  File "c:\Users\TechnoDot\Desktop\VSCode\TechnoBot\utils.py", line 93, in <module>
    aternos.from_credentials(data["aternos.username"], data["aternos.password"])
  File "C:\Users\TechnoDot\AppData\Local\Programs\Python\Python311\Lib\site-packages\python_aternos\atclient.py", line 146, in from_credentials
    return cls.from_hashed(
           ^^^^^^^^^^^^^^^^
  File "C:\Users\TechnoDot\AppData\Local\Programs\Python\Python311\Lib\site-packages\python_aternos\atclient.py", line 102, in from_hashed
    loginreq = atconn.request_cloudflare(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\TechnoDot\AppData\Local\Programs\Python\Python311\Lib\site-packages\python_aternos\atconnect.py", line 279, in request_cloudflare
    req.raise_for_status()
  File "C:\Users\TechnoDot\AppData\Local\Programs\Python\Python311\Lib\site-packages\requests\models.py", line 1021, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 503 Server Error: Service Unavailable for url: https://aternos.org/panel/ajax/account/login.php?TOKEN=XXXXXXXXXXXXXXXXXXXX&SEC=XXXXXXXXXXXXXXXXX%3XXXXXXXXXXXXXXXXX

I tried modifying the browser headers a bit, image using several browsers, image and nothing worked.

I think that this is anti-automation by aternos, 503 is the error code for Service Unavalible (as show above) and real browsers dont work. I can still access my aternos account normally, so im pretty sure that aternos maybe changed their API or something as an anti-automation measure to try to catch people who were automating the process. Great, now i better back up my worlds now 😎

Any ideas? Thanks in advance!

- TechnoDot

DarkCat09 commented 1 year ago

TypeError: Client.init() missing 1 required positional argument: 'atconn'

You have a really old version of python-aternos.

pip install -U python-aternos
DarkCat09 commented 1 year ago

503 is because of https://github.com/DarkCat09/python-aternos/issues/74#issuecomment-1551110292