Token and SEC are empty when logging in with session cookie
Closed this issue · 5 comments
1Marcuth commented
Code:
from python_aternos import Client
aternos = Client()
aternos.login_with_session('---')
account = aternos.account
# Get servers list
servs = account.list_servers()
print(account.servers[0].port)
print(len(servs))
myserv = servs[0]
print(myserv.is_java)
myserv.start()
Error
Traceback (most recent call last):
File "d:\programming\projects\actives\python\mc-server-bot\main.py", line 27, in <module>
myserv.start()
File "D:\programming\projects\actives\python\mc-server-bot\.venv\Lib\site-packages\python_aternos\atserver.py", line 149, in start
startreq = self.atserver_request(
^^^^^^^^^^^^^^^^^^^^^^
File "D:\programming\projects\actives\python\mc-server-bot\.venv\Lib\site-packages\python_aternos\atconnect.py", line 282, in request_cloudflare
req.raise_for_status()
File "D:\programming\projects\actives\python\mc-server-bot\.venv\Lib\site-packages\requests\models.py", line 1021, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: https://aternos.org/ajax/server/start?headstart=0&access-credits=0&TOKEN=&SEC=
DarkCat09 commented
Did you cut out the values of TOKEN and SEC parameters in the URL?
This data is not secret.
If python-aternos doesn't generate valid token and SEC, it is a really important issue.
1Marcuth commented
Did you cut out the values of TOKEN and SEC parameters in the URL?
This data is not secret.
If python-aternos doesn't generate valid token and SEC, it is a really important issue.
I put the right value in the original code
Poleric commented
Same issue here.
A bit hacky but this worked for me.
# run once
myserv.atconn.parse_token()
myserv.atconn.generate_sec()
myserv.start()
1Marcuth commented
myserv.atconn.parse_token() myserv.atconn.generate_sec()
Then the server information was missing, I used myserv.fetch()
and it worked! Thank you very much! :D