Empty session cookie bugfix, Readme, v2.1.4

This commit is contained in:
DarkCat09 2022-11-03 18:01:53 +04:00
parent 125d761b00
commit 8177e8bd2a
3 changed files with 11 additions and 5 deletions

View file

@ -83,7 +83,7 @@ aternos = Client.from_credentials('example', 'test123')
# ----OR---- # ----OR----
aternos = Client.from_hashed('example', 'cc03e747a6afbbcbf8be7668acfebee5') aternos = Client.from_hashed('example', 'cc03e747a6afbbcbf8be7668acfebee5')
# ----OR---- # ----OR----
aternos = Client.restore_session() aternos = Client.from_session('ATERNOS_SESSION cookie')
# Returns AternosServer list # Returns AternosServer list
servs = aternos.list_servers() servs = aternos.list_servers()
@ -103,7 +103,7 @@ for serv in servs:
testserv = serv testserv = serv
if testserv is not None: if testserv is not None:
# Prints a server softaware and its version # Prints the server software and its version
# (for example, "Vanilla 1.12.2") # (for example, "Vanilla 1.12.2")
print(testserv.software, testserv.version) print(testserv.software, testserv.version)
# Starts server # Starts server
@ -130,7 +130,7 @@ if testserv is not None:
|**v1.1.2/v2.0.0**|Solution for [#25](https://github.com/DarkCat09/python-aternos/issues/25) (Cloudflare bypassing), bugfixes in JS parser.| |**v1.1.2/v2.0.0**|Solution for [#25](https://github.com/DarkCat09/python-aternos/issues/25) (Cloudflare bypassing), bugfixes in JS parser.|
|v2.0.x|Documentation, automatically saving/restoring session, improvements in Files API.| |v2.0.x|Documentation, automatically saving/restoring session, improvements in Files API.|
|v2.1.x|Fixes in websockets API, atconnect. Supported captcha solving services (view [#52](https://github.com/DarkCat09/python-aternos/issues/52)).| |v2.1.x|Fixes in websockets API, atconnect. Supported captcha solving services (view [#52](https://github.com/DarkCat09/python-aternos/issues/52)).|
|**v2.2.x**|Using Node.js as a JS interpreter if it's installed.| |**v2.2.x**|Using Node.js as a JS interpreter if it's installed, fixed cookie refreshing.|
|v3.0.x|Full implementation of config and software API.| |v3.0.x|Full implementation of config and software API.|
|v3.1.x|Shared access API and Google Drive backups.| |v3.1.x|Shared access API and Google Drive backups.|

View file

@ -39,6 +39,7 @@ class AternosConnect:
self.session = self.cf_init() self.session = self.cf_init()
self.sec = '' self.sec = ''
self.token = '' self.token = ''
self.atcookie = ''
def add_args(self, **kwargs) -> None: def add_args(self, **kwargs) -> None:
"""Pass arguments to CloudScarper """Pass arguments to CloudScarper
@ -197,6 +198,11 @@ class AternosConnect:
if retry <= 0: if retry <= 0:
raise CloudflareError('Unable to bypass Cloudflare protection') raise CloudflareError('Unable to bypass Cloudflare protection')
try:
self.atcookie = self.session.cookies['ATERNOS_SESSION']
except KeyError:
pass
self.refresh_session() self.refresh_session()
params = params or {} params = params or {}
@ -215,7 +221,7 @@ class AternosConnect:
headers['X-Requested-With'] = 'XMLHttpRequest' headers['X-Requested-With'] = 'XMLHttpRequest'
# requests.cookies.CookieConflictError bugfix # requests.cookies.CookieConflictError bugfix
reqcookies['ATERNOS_SESSION'] = self.atsession reqcookies['ATERNOS_SESSION'] = self.atcookie
del self.session.cookies['ATERNOS_SESSION'] del self.session.cookies['ATERNOS_SESSION']
reqcookies_dbg = { reqcookies_dbg = {

View file

@ -5,7 +5,7 @@ with open('README.md', 'rt') as readme:
setuptools.setup( setuptools.setup(
name='python-aternos', name='python-aternos',
version='2.1.3', version='2.1.4',
author='Chechkenev Andrey (@DarkCat09)', author='Chechkenev Andrey (@DarkCat09)',
author_email='aacd0709@mail.ru', author_email='aacd0709@mail.ru',
description='An unofficial Aternos API', description='An unofficial Aternos API',