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)._raw
(dict)
.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
(dict)
.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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file econuker-1.0.9.tar.gz
.
File metadata
- Download URL: econuker-1.0.9.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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 50eae9180cb62da98f47bbc1147e6245c2d2bc4e2354aedb6a809a30b93615e8 |
|
MD5 | b8ac9b5e04111d284558ea5a8f4e2a91 |
|
BLAKE2b-256 | 1796efc8a457bb0eab577fbf6b33fce770c145f4b95111a41db799348b075872 |
File details
Details for the file econuker-1.0.9-py3-none-any.whl
.
File metadata
- Download URL: econuker-1.0.9-py3-none-any.whl
- Upload date:
- Size: 9.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0daec2419672b5a3006394a87477b3f67171c3fce4faead5118de55d421ac877 |
|
MD5 | 75a6ed1b6482fe941c6cefd4dd745fbc |
|
BLAKE2b-256 | 1610af5b0e7f564394c9157bd94415b2e244a9a764d126c902abd00e91f30d00 |