atclient
(Entry point)#
Entry point. Authorizes on Aternos and allows to manage your account
Client
#
Aternos API Client class object of which contains user's auth data
__init__(atconn, servers=None)
#
Aternos API Client class object of which contains user's auth data
Parameters:
Name | Type | Description | Default |
---|---|---|---|
atconn |
AternosConnect
|
AternosConnect instance with initialized Aternos session |
required |
servers |
Optional[List[str]]
|
List with servers IDs |
None
|
change_email(value)
#
Changes an e-mail in your Aternos account
Parameters:
Name | Type | Description | Default |
---|---|---|---|
value |
str
|
New e-mail |
required |
Raises:
Type | Description |
---|---|
ValueError
|
If an invalid e-mail address was passed to the function |
change_password(old, new)
#
Changes a password in your Aternos account
Parameters:
Name | Type | Description | Default |
---|---|---|---|
old |
str
|
Old password |
required |
new |
str
|
New password |
required |
change_password_hashed(old, new)
#
Changes a password in your Aternos account.
Unlike change_password
, this function
takes hashed passwords as arguments
Parameters:
Name | Type | Description | Default |
---|---|---|---|
old |
str
|
Old password hashed with MD5 |
required |
new |
str
|
New password hashed with MD5 |
required |
change_username(value)
#
Changes a username in your Aternos account
Parameters:
Name | Type | Description | Default |
---|---|---|---|
value |
str
|
New username |
required |
from_credentials(username, password, sessions_dir='~')
classmethod
#
Log in to Aternos with a username and a plain password
Parameters:
Name | Type | Description | Default |
---|---|---|---|
username |
str
|
Your username |
required |
password |
str
|
Your password without any encryption |
required |
sessions_dir |
str
|
Path to the directory where session will be automatically saved |
'~'
|
from_hashed(username, md5, sessions_dir='~')
classmethod
#
Log in to an Aternos account with a username and a hashed password
Parameters:
Name | Type | Description | Default |
---|---|---|---|
username |
str
|
Your username |
required |
md5 |
str
|
Your password hashed with MD5 |
required |
sessions_dir |
str
|
Path to the directory where session will be automatically saved |
'~'
|
Raises:
Type | Description |
---|---|
CredentialsError
|
If the API didn't return a valid session cookie |
from_session(session, servers=None)
classmethod
#
Log in to Aternos using a session cookie value
Parameters:
Name | Type | Description | Default |
---|---|---|---|
session |
str
|
Value of ATERNOS_SESSION cookie |
required |
get_server(servid)
#
Creates a server object from the server ID. Use this instead of list_servers if you know the ID to save some time.
Returns:
Type | Description |
---|---|
AternosServer
|
AternosServer object |
list_servers(cache=True)
#
Parses a list of your servers from Aternos website
Parameters:
Name | Type | Description | Default |
---|---|---|---|
cache |
bool
|
If the function should use cached servers list (recommended) |
True
|
Returns:
Type | Description |
---|---|
List[AternosServer]
|
List of AternosServer objects |
logout()
#
Log out from Aternos account
md5encode(passwd)
staticmethod
#
Encodes the given string with MD5
Parameters:
Name | Type | Description | Default |
---|---|---|---|
passwd |
str
|
String to encode |
required |
Returns:
Type | Description |
---|---|
str
|
Hexdigest hash of the string in lowercase |
refresh_servers(ids)
#
Replaces cached servers list creating AternosServer objects by given IDs
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ids |
List[str]
|
Servers unique identifiers |
required |
restore_session(file='~/.aternos')
classmethod
#
Log in to Aternos using a saved ATERNOS_SESSION cookie
Parameters:
Name | Type | Description | Default |
---|---|---|---|
file |
str
|
File where a session cookie was saved |
'~/.aternos'
|
save_session(file='~/.aternos', incl_servers=True)
#
Saves an ATERNOS_SESSION cookie to a file
Parameters:
Name | Type | Description | Default |
---|---|---|---|
file |
str
|
File where a session cookie must be saved |
'~/.aternos'
|
incl_servers |
bool
|
If the function should include the servers IDs to reduce API requests count (recommended) |
True
|
secure_name(filename, repl='_')
staticmethod
#
Replaces unsecure characters
in filename to underscore or repl
Parameters:
Name | Type | Description | Default |
---|---|---|---|
filename |
str
|
Filename |
required |
repl |
str
|
Replacement for unsafe characters |
'_'
|
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
Secure filename |