Python

The Python library is a single file that can be imported into your project. It is available for Windows, Linux, and macOS.

Installation

To install the Flux library, simply download the flux.py file and place it in your project directory.

Usage

To use the Flux library, import the Flux class from the flux module.

from flux import Flux

Initialize Flux

Create a new instance of the Flux class, providing your application ID as a parameter.

flux = Flux("your_application_id")

Authenticate

To authenticate a user, call the authenticate method with the user’s license key and an optional hardware ID.

try:
    flux.authenticate(license, hwid)
except Exception as e:
    print("Authentication failed: ", e.message)
    return

If the authentication is successful, the method will return the string "success". Otherwise, the method will return "failure".

Get Fields

To retrieve a field from the authentication response, use the get_field method, providing the field name and the type of the field.

print("Expires: ", flux.get_field("expiresAt", int))

Get Variables

To retrieve a variable from the server, use the get_variable method, providing the variable name and the type of the variable.

print("Authenticated Variable: ", flux.get_variable("str", str))

Download Variables

To download a variable as a file, use the download_variable method, providing the variable name.

data = flux.download_variable("file")
with open("file.bin", "wb") as out:
    out.write(data)

This method will return the decrypted data of the file. You can then save it to disk or manipulate it as needed.

Example

from flux import Flux

flux = Flux("your-application-id")
print(flux.get_variable("unauthenticated-variable", str))

license = input("Enter license: ")
try:
    auth = flux.authenticate(license, get_hwid())
except Exception as e:
    print("Error: " + str(e))
    exit(1)

print("Expires: " + str(flux.get_field("expiresAt", int)))
print("Authenticated Variable: " + flux.get_variable("secret", str))
data = flux.download_variable("file")
with open("file.bin", "wb") as out:
    out.write(data)