Skip to main content

A python library to interact with the EarnApp API

Project description

EarnApp.py

PyPI Link: https://pypi.org/project/EarnApp/

Table of contents

General info

A Python library to interact with the EarnApp API.

Documentation

  1. First, import the library: from earnapp import earnapp
  2. Next, you can initialize a user. You can have as many users as you like and each user can have a different token. Initialize it with something: user = earnapp.User(). You can also initialize a Client which allows you to interact with the client API, like so: client = earnapp.Client(uuid, version, arch, appid). These options can be changed later with their variable names, for example: client.uuid = newUUID.
  3. Log into the EarnApp account with user.login("ENTER oauth-refresh-token HERE"). A client object does not require any authentication.
  4. The login function will return a IncorrectTokenException if the token is incorrect.
try:
    user.login("ENTER oauth-refresh-token HERE")
except earnapp.IncorrectTokenException:
    print("Incorrect token")
    raise SystemExit
  1. Now, you can use whatever functions you like, for example print("Money: " + str(user.money())), or you can get information from the client API: print("App details: " + str(client.appConfigWin())).

User Functions:

  • setProxy - Sets the proxy for the requests. Argument is a dictionary with the proxy in requests format, for example: {"https": "socks5://admin:P455w0rd@1.1.1.1:5442"}.
  • login - Logs in to the EarnApp account. Argument is the oauth-refresh-token string.
  • userData - Get data about the logged in user.
  • money - Get data about the logged in user's money.
  • devices - Get data about the logged in user's devices.
  • appVersions - Get the latest app version.
  • paymentMethods - Get all available payment methods.
  • transactions - Get past transactions and their status.
  • linkDevice - Link a device to the logged in EarnApp account. Argument is the device id string.
  • hideDevice - Hide a device from the logged in EarnApp account. Argument is the device id string.
  • showDevice - Show a device on the logged in EarnApp account. Argument is the device id string.
  • deleteDevice - Delete a device from the logged in EarnApp account. Argument is the device id string.
  • renameDevice - Rename a device on the logged in EarnApp account.
  • redeemDetails - Change the redeem details of the logged in EarnApp account. Argument is the new email address for payments, and optionally paymentMethod can be an available payment method, defaults to "paypal.com".
  • onlineStatus - Gets the online status of the devices passed. Argument is a list of device ids.
  • usage - Gets the usage stats of all devices shown in the given timeframe. Argument can be daily, weekly, or monthly.

Client Functions:

  • appConfigWin - Get many details about the device, including bandwidth, earnings, referral code of linked account, and available payment methods.
  • appConfigNode - Think this returns the latest Linux version, not 100% sure.
  • appConfig - No idea what this is, it just seems to return an empty array in my tests.
  • isPiggybox - Check if the device is a piggybox.
  • ndt7 - Not sure, think it's a speedtest or something for piggybox.
  • installDevice - Register the device with the server. This is called by the app when the device is first installed.
  • getBWStats - Shows total bandwidth and total earnt.
  • isLinked - Shows the email address of the account the device is linked to.
  • isIPBlocked - Checks if the IP used for the request is blocked.

Exceptions:

  • IncorrectTokenException - Raised when the token is incorrect
  • RatelimitedException - Raised when the IP is ratelimited
  • JSONDecodeErrorException - Raised when the JSON data returned by the EarnApp API is invalid
  • XRSFErrorException - Raised when the script fails to retrieve an XRSF token
  • InvalidTimeframeException - Raised when the given timeframe is invalid. Must be 'daily', 'weekly', or 'monthly'.
  • InvalidArgumentsException - Raised when the given client arguments are invalid.

You can set a timeout for the requests with user.timeout or client.timeout, for example, to set the timeout to 10 seconds (default):

user.timeout = 10

Setup

To install/update this library, use pip:

$ pip3 install --upgrade earnapp

Examples

Will tell you your current balance:

from earnapp import earnapp

user = earnapp.User()
try:
    user.login("ENTER oauth-refresh-token HERE")
except earnapp.IncorrectTokenException:
    print("Incorrect token")
    raise SystemExit

print("Current balance: " + str(user.money()["balance"]))

Shows the total bandwidth of a device in bytes:

from earnapp import earnapp

client = earnapp.Client("UUID", "VERSION", "CPU", "APPID")
try:
    data = client.appConfigWin()
    print("Total bandwidth in bytes: " + str(data["server_bw_total"]))
except earnapp.InvalidArgumentsException:
    print("Invalid arguments")
    raise SystemExit

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

earnapp-0.1.9.tar.gz (20.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

earnapp-0.1.9-py3-none-any.whl (20.2 kB view details)

Uploaded Python 3

File details

Details for the file earnapp-0.1.9.tar.gz.

File metadata

  • Download URL: earnapp-0.1.9.tar.gz
  • Upload date:
  • Size: 20.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.6

File hashes

Hashes for earnapp-0.1.9.tar.gz
Algorithm Hash digest
SHA256 2803207fe28339387a21d17e3d456089bbc885f74ed462f5bfc43c58181dad64
MD5 46ee494eb134f1838e4653a99bcd14a5
BLAKE2b-256 e3efc0ba2b4233738065c6575d269ddf96c5ff3894f3d91900b34dca0c01a68a

See more details on using hashes here.

File details

Details for the file earnapp-0.1.9-py3-none-any.whl.

File metadata

  • Download URL: earnapp-0.1.9-py3-none-any.whl
  • Upload date:
  • Size: 20.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.6

File hashes

Hashes for earnapp-0.1.9-py3-none-any.whl
Algorithm Hash digest
SHA256 0d7dabe1309b606e7670c0bfb798e266a964bc462339a385ef30021f06979887
MD5 de6ae6b299ba427d174c99b94cd5eb52
BLAKE2b-256 d70772ce68bc08cf0277a66a497fd3df1dd0044cbb824b4ce738e210f8142ef8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page