Skip to main content

danbot-status

travis-ci CodeQL Upload Python Package

DanBot Status is a module built in python for getting all statistical services used by DanBotHost.

Changelog

  • v0.0.1: Initial release
  • v0.0.2: Converted the module to a Asynchronous Package
  • v0.1.1: Added Support for Synchronous and Asynchronous Programming
  • v0.2.0: Rewrote the module to use the new version of the API
  • v0.2.1: Fixed some README mistakes

Upgrade Module

pip install --upgrade danbot-status

Installation

pip install danbot-status --> For Windows

pip3 install danbot-status --> For Linux

Usage

import danbotstatus --> Importing Module in Python

Classes

danbotstatus.SynchronousState() --> For Synchronous Coding

danbotstatus.AsynchronousState() --> For Asynchronous Coding

Errors

danbotstatus.APIError() -> Thrown when the API is not responding or is down

Basic Example Of danbotstatus in Asynchronous Environment In Discord Bot (discord.py)

This method needs the module discord.py

import discord
from danbotstatus import AsynchronousState()
dbs = AsynchronousState()
bot = discord.Client()

@bot.event
async def on_ready():
    print("Logged In as " + bot.user )
    
    
@bot.event
async def on_message(message):
    if message.content == 'check all node status':
        nodestats = await dbs.fetch_all()
        await message.channel.send(nodestats)
        
bot.run("TOKEN")

Basic Example Of danbotstatus in Synchronous Environment In Flask (Flask)

This method needs the module Flask

from flask import Flask
from danbotstatus import SynchronousState
dbs = SynchronousState()
app = Flask(__name__)

@app.route('/')
def index():
    return {'status': "alive"}
    
    
@app.route('/allstats')
def nodestats():
    ns = dbs.fetch_all()
    return ns
        
if __name__ == '__main__':
    app.run()

Basic Functions in the module (SynchronousState)

pssst, this is not an example , this just shows the functions the module has

from danbotstatus import SynchronousState
dbhs = danbotstatus.SynchronousState()
allnodestats = dbhs.fetch_all()   # Gets All Stats
time = dbhs.fetch_time()   # Gets the time of the API
names = dbhs.fetch_server_names()   # Gets the names of the nodes
stats = dbhs.fetch_server_stats("Server Name", 3)   # Gets the stats of the specific servers, Accepts 2 Optional Arguements, either the server name or the index positioning of the dictionary

print(allnodestats)  # This method returns a dictionary
print(time)  # This method returns a string
print(names)  # This method returns a list
print(stats)  # This method returns a dictionary

Basic Functions in the module (AsynchronousState)

pssst, this is not an example , this just shows the functions the module has

from danbotstatus import AsynchronousState
dbhs = AsynchronousState()
allnodestats = await dbhs.fetch_all()   # Gets All Stats
time = await dbhs.fetch_time()   # Gets the time of the API
names = await dbhs.fetch_server_names()   # Gets the names of the nodes
stats = await dbhs.fetch_server_stats("Server Name", 3)   # Gets the stats of the specific servers, Accepts 2 Optional Arguements, either the server name or the index positioning of the dictionary

print(allnodestats)  # This method returns a dictionary
print(time)  # This method returns a string
print(names)  # This method returns a list
print(stats)  # This method returns a dictionary

Thank You.

Module Built By Viney. Any Queries or Issue, feel free to make an Issue in the issue tab of Github. This project is welcome to receive any contributions by submitting in PR's

Metadata

Release files for danbot-status 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for danbot-status 0.2.1
File Size Uploaded
danbot-status-0.2.1.tar.gz 4.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for danbot-status 0.2.1
File Interpreter ABI Platform
danbot_status-0.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 10.2 kB

Release files / danbot-status-0.2.1.tar.gz

Download URL danbot-status-0.2.1.tar.gz
Size 4.4 kB
Tags Source
SHA-256 checksum
How to use checksums
aec7d185a0d90652eb64dd3cfb75bc3db832c62f9c4cda045d8587db36f0e46f
BLAKE2b-256 checksum
How to use checksums
0ebfbec5038c99637fb2261808c5345207d5961a6d23c46fb4dd03dcf89a65c2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.13

Release files / danbot_status-0.2.1-py3-none-any.whl

Download URL danbot_status-0.2.1-py3-none-any.whl
Size 5.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3c1456929d972c1ffe6732c3a704b956a06cffbc6b3cbfb063c6e51d8b9d67e2
BLAKE2b-256 checksum
How to use checksums
2d0a9bae567fa2a6e154fc874c7abbcf0282bf67a494d98cb22835ff970b532b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.13

Release history Release notifications | RSS feed

This release

0.2.1 This release

2 release files

0.1.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page