Skip to main content

API wrapper for https://api.econuker.xyz

Project description

EcoNuker

EcoNuker is a Python library for interacting with the EcoNuker API, which provides routes for items, servers, and more!

The base URLs are: https://econuker.xyz/api and https://beta.econuker.xyz/api (beta version)

PyPi: https://pypi.org/project/econuker/

Installation

You can install the EcoNuker-API library using pip:

pip install econuker

Usage

Initialize a Client or AsyncClient class. Make sure to pass auth_token and beta if needed.

You can now use the client to make requests.

Example

# Python Example
from econuker import Client
beta = True # False
authtoken = None # "your auth token here"

if __name__ == "__main__":
    client = Client(auth_token=authtoken, beta=beta)
    status = client.status()
    print(status.name)

Async Example

# Python Async Example
from econuker import AsyncClient
beta = True # False
authtoken = None # "your auth token here"

if __name__ == "__main__":
    client = AsyncClient(auth_token=authtoken, beta=beta)
    async def asyncfunction():
        status = await client.status()
        print(status.name)
        return status
    asyncio.run(asyncfunction())

Downtime Notifier Example

# Python Downtime Notifier Example
import econuker
from econuker import AsyncClient
beta = True # get notified about downtime of our Beta bot.
authtoken = None

down = False

import guilded # pip install guilded.py
import asyncio
client = guilded.Client()
channelid = "" # the channel you want downtime notifications to be sent to! Make sure your bot has permissions.

async def monitorbot(client:AsyncClient):
    global down
    bot_name = await client.status().name
    while True:
        check = await client.ping()
        if not check:
            if not down:
                channel = await bot.fetch_channel(channelid)
                await channel.send(f'{bot_name} is down!')
                down = True
        if check and down:
            down = False
            channel = await bot.fetch_channel(channelid)
            await channel.send(f'{bot_name} is online!')
        await asyncio.sleep(10)

@bot.event
async def on_ready():
    print(f'Ready! Logged in as {bot.user.name}')
    try:
        client
    except:
        client = AsyncClient(beta=beta, auth_token=authtoken)
        bot.loop.create_task(monitorbot(client))

bot.run('guilded bot token here')

Documentation

For detailed documentation on the EcoNuker API, read https://docs.econuker.xyz/

For detailed documentation on how to use the EcoNuker-API library, please wait while we write it lol.

Methods

A list of methods you can call with either Client or AsyncClient.

  • .status() (class StatusData)
    • .name (string)
    • .status (string)
    • .servers (integer)
    • .latency (float)
  • .ping() (bool)
  • .verify(auth_token) (Union(class Token, False))
    • .authtoken (string)
    • .authlevel (string)
    • ._raw (dict)
  • .fetch_servers() (class ServersResult)
    • .count (integer)
    • .server_ids (list)
    • ._raw (dict)
  • .fetch_server(id) (class ServerResult)
    • .name (string)
    • .id (string)
    • .owner (class Owner)
      • .name (string)
      • .id (string)
      • .nick (Union(string, None))
      • .profile (string)
      • ._raw
    • .url (Union(string, None))
    • .verified (bool)
    • .created_at (integer)
    • .timezone (string)
    • .slug (Union(string, None))
    • .about (Union(string, None))
    • ._raw (dict)
  • .fetch_items(hidden=True) (class ItemsResult)
    • ._raw (dict)
  • .fetch_item(id, name) (class ItemResult)
    • .id (string)
    • .name (string)
    • .rarity (string)
    • .description (string)
    • .desc (string)
    • .aliases (list)
    • .price (class ItemPrice)
      • .sell (str)
      • .buy (str)
      • .worth (str)
      • ._raw (dict)
      • ._price_parts (list) ([sell, buy])
    • ._raw (dict)
    • ._data (list)

License

This project is licensed under the MIT License. See the LICENSE file for details.

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

econuker-1.0.8.tar.gz (8.3 kB view details)

Uploaded Source

Built Distribution

econuker-1.0.8-py3-none-any.whl (9.8 kB view details)

Uploaded Python 3

File details

Details for the file econuker-1.0.8.tar.gz.

File metadata

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

File hashes

Hashes for econuker-1.0.8.tar.gz
Algorithm Hash digest
SHA256 db3382151d153b5c897550f2c065a2fdd638ba02b58e7907ba261768d43dd25a
MD5 6c63c4dcae562f54be4db8252776de49
BLAKE2b-256 0c843e018bec9fd3063bc8de55772eb409539ad2d23b489f189757a163ce81f4

See more details on using hashes here.

File details

Details for the file econuker-1.0.8-py3-none-any.whl.

File metadata

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

File hashes

Hashes for econuker-1.0.8-py3-none-any.whl
Algorithm Hash digest
SHA256 31054c7a72c36ad7877bd0613f21ed634774671340e14ea3f44d582cefcde252
MD5 68d551380bab877e69e6218cc81c9c70
BLAKE2b-256 bf4cd6a99c5f0d58ba9871cf4aa22bbdf6f6ce285940d4a5324f1e9be56973bb

See more details on using hashes here.

Supported by

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