-
Couldn't load subscription status.
- Fork 10
AternosConnect
python_aternos.AternosConnect.__init__(self)
Example:
from python_aternos import AternosConnect
atconn = AternosConnect()python_aternos.AternosConnect.get_token(self, response=None)
Parses TOKEN from the html, received in response parameter,
or from login page (aternos.org/go) if response was not specified.
-
response(optional) - a page content had to be parsed.
Example:
atconn.get_token()python_aternos.AternosConnect.generate_sec(self)
Generates SEC using an Aternos algorithm extracted from aternos.org/panel/js/main.js by me.
Uses generate_aternos_rand().
Example:
atconn.generate_sec()python_aternos.AternosConnect.generate_aternos_rand(self, randlen=16)
Generates random string using an Aternos algorithm extracted from aternos.org/panel/js/main.js by me.
The difference between normal generator and this algorithm is that the Aternos random uses a math function.
It generates random number between 0 and 1 (with base 10) and converts it to 36-base number (A-Z + 0-9).
-
randlen(optional) - a length of string need to be generated. Counts from 1 (not 0).
Example:
atconn.generate_aternos_rand()
# OR
atconn.generate_aternos_rand(randlen=12)python_aternos.AternosConnect.convert_num(self, num, base)
A helper function for generate_aternos_rand.
Converts number to a numeral system with the specified base.
-
num- a number to convert. -
base- a base for a numeral system. It can't be more than 36.
Example:
# Convert integer number 25 to a binary
atconn.convert_num(25, 2)python_aternos.AternosConnect.request_cloudflare(self, url, method, retries=10, params=None, data=None, headers=None, reqcookies=None, sendtoken=False)
Makes a GET or a POST request using cloudscraper to avoid Cloudflare protection.
-
url- a requested URL address. -
method- a request method (GET or POST).
Can be represented as one of theREQGETandREQPOSTconstants. -
retries(optional) - a number of retries to accessaternos.orgavoiding Cloudflare.
The default value (10) is optimal. -
params(optional) - parameters dictionary for a GET request. -
data(optional) - data dictionary for a POST request. -
headers(optional) - headers for a request. -
reqcookies(optional) - cookies dictionary for a request (cookies will not be saved). -
sendtoken(optional) - sendTOKENandSECin this request?
Example:
atconn.request_cloudflare('https://aternos.org/go', atconn.REQGET)Note: If you don't specify headers,
User-Agentheader will be added anyway.
python_aternos.AternosConnect.REQGET
It's a constant for specifying a GET-method in request_cloudflare.
Value: 0.
python_aternos.AternosConnect.REQPOST
It's a constant for specifying a POST-method in request_cloudflare.
Value: 1.
python_aternos.AternosConnect.REQUA
This constant contains the User-Agent for requests.
Value: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:68.0) Gecko/20100101 Goanna/4.8 Firefox/68.0 PaleMoon/29.4.0.2.