Open deedtm opened 1 year ago
code:
class Aternos:
def __init__(self, username, hashed_password):
aternos_client = Client()
aternos_client.login_hashed(username=username, md5=hashed_password)
self.at = aternos_client.account
self.servers = aternos_client.account.servers
def get_server_by_subdomain(self, subdomain):
at = self.at
servers = self.servers
print(servers)
for server in servers:
print(server.subdomain)
if server.subdomain == subdomain:
try:
server.fetch()
except requests.exceptions.HTTPError:
at.atconn.parse_token()
self.get_server_by_subdomain(subdomain)
return server
return None
@deedtm,
Call server.fetch()
before getting any data from the _info dictionary.
Formerly, there was an "autoparsing" feature: the dictionary was requested automatically on creating AternosServer object. But now, due to Aternos API updates, python-aternos parses an HTML page to load _info that takes some time and resources, so I'm going to implement that feature through autoparse
field in AternosClient and/or AternosAccount that will be disabled by default.
Выполняйте server.fetch()
перед получением любых данных из словаря _info.
Раньше был функционал "автопарсинга": словарь автоматически запрашивался по АПИ при создании объекта сервера — AternosServer. Но теперь (после обновления АПИ атерноса) модуль парсит целую хтмл-страницу для получения словаря с инфой, что немного дольше и требует чуть больше ресурсов. Собираюсь тот функционал реализовать через поле autoparse
в AternosClient и/или AternosAccount, что по дефолту будет выключено.
TODO:
@deedtm,
Call
server.fetch()
before getting any data from the _info dictionary. Formerly, there was an "autoparsing" feature: the dictionary was requested automatically on creating AternosServer object. But now, due to Aternos API updates, python-aternos parses an HTML page to load _info that takes some time and resources, so I'm going to implement that feature throughautoparse
field in AternosClient and/or AternosAccount that will be disabled by default.Выполняйте
server.fetch()
перед получением любых данных из словаря _info. Раньше был функционал "автопарсинга": словарь автоматически запрашивался по АПИ при создании объекта сервера — AternosServer. Но теперь (после обновления АПИ атерноса) модуль парсит целую хтмл-страницу для получения словаря с инфой, что немного дольше и требует чуть больше ресурсов. Собираюсь тот функционал реализовать через полеautoparse
в AternosClient и/или AternosAccount, что по дефолту будет выключено.
i had to go into the library itself and manually enable the autofetch option in the AternosServer class ;-;
эта ошибка появляется всегда, когда пытаюсь получить какую-либо информацию о сервере, причем сами сервера как объект AternosServer выдаются. залез в сурс код и с помощью принта узнал, что self._info всегда является пустым словарем.