Skip to main content

Status Of All Services of DanBotHost(DBH)

Project description

danbot-status

travis-ci

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

Installation

pip install danbot-status --> For Windows

pip3 install danbot-status --> For Linux

Usage

import danbotstatus --> Importing Module in Python

Classes

danbotstatus.SynchronousStatus() --> For Synchronous Coding danbotstatus.AsynchronousStatus() --> For Asynchronous Coding

Errors

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

danbotstatus.NodeError() -> Thrown when the Node is not available

danbotstatus.NodeNegaiveError() -> Thrown when the Node value passed is a negative value

danbotstatus.LavaError() -> Thrown when the Lava node is not available

danbotstatus.LavaNegativeError() -> Thrown when the Lava node value passed is a negative value

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

This method needs the module discord.py

import discord
from danbotstatus import AsynchronousStatus
dbs = AsynchronousStatus()
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.getallnodestats()
        await message.channel.send(nodestats)
        
bot.run("TOKEN")

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

This method needs the module discord.py

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

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

Basic Functions in the module (SynchronousStatus)

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

from danbotstatus import SynchronousStatus
dbhs = danbotstatus.SynchronousStatus()
allnodestats = dbhs.getallnodestats()   # Gets All Node Status
allstats = dbhs.getallstats()   # Gets All Status including nodestatus and misc
allawait sysinfo = dbhs.getallsysinfo()   # Gets All Node System Informations
lavastats = dbhs.getlavastatus(int)  #Gets a particular lava status, Replace int by number. For example: lavastats = dbhs.getlavastatus(1)  gives Lava1 information
misc = dbhs.getmiscstatus()  # Gets misc status
leaderboard = dbhs.leaderboard()  # Gets Leaderboard 
nodestats = dbhs.getnodestatus(int) # Gets a particular node status
sysinfo = dbhs.getsysinfo(int) # Gets a particular node information, Replace int by node number
print(allnodestats)   # Returns data in dictionary
print(allstats)        # Returns data in dictionary
print(allsysinfo)        # Returns data in dictionary
print(lavastats)         # Returns data in bool from --> True if its online, False if its offline
print(leaderboard)  #Returns data in list
print(nodestats)    # Returns data in dictionary
print(sysinfo) # Returns data in dictionary

Basic Functions in the module (AsynchronousStatus)

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

from danbotstatus import AsynchronousStatus
dbhs = AsynchronousStatus()
allnodestats = await dbhs.getallnodestats()   # Gets All Node Status
allstats = await dbhs.getallstats()   # Gets All Status including nodestatus and misc
allawait sysinfo = await dbhs.getallsysinfo()   # Gets All Node System Informations
lavastats = await dbhs.getlavastatus(int)  #Gets a particular lava status, Replace int by number. For example: lavastats = dbhs.getlavastatus(1)  gives Lava1 information
misc = await dbhs.getmiscstatus()  # Gets misc status
leaderboard = await dbhs.leaderboard()  # Gets Leaderboard 
nodestats = await dbhs.getnodestatus(int) # Gets a particular node status
sysinfo = await dbhs.getsysinfo(int) # Gets a particular node information, Replace int by node number
print(allnodestats)   # Returns data in dictionary
print(allstats)        # Returns data in dictionary
print(allsysinfo)        # Returns data in dictionary
print(lavastats)         # Returns data in bool from --> True if its online, False if its offline
print(leaderboard)  #Returns data in list
print(nodestats)    # Returns data in dictionary
print(sysinfo) # Returns data in 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

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

danbot-status-0.1.1.tar.gz (5.3 kB view hashes)

Uploaded Source

Built Distribution

danbot_status-0.1.1-py3-none-any.whl (6.8 kB view hashes)

Uploaded Python 3

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