Skip to main content

Status Of All Services of DanBotHost(DBH)

Project description

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

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.2.1.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

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

danbot_status-0.2.1-py3-none-any.whl (5.8 kB view details)

Uploaded Python 3

File details

Details for the file danbot-status-0.2.1.tar.gz.

File metadata

  • Download URL: danbot-status-0.2.1.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for danbot-status-0.2.1.tar.gz
Algorithm Hash digest
SHA256 aec7d185a0d90652eb64dd3cfb75bc3db832c62f9c4cda045d8587db36f0e46f
MD5 3b45e62646c841d10a3221c07b4cfe1a
BLAKE2b-256 0ebfbec5038c99637fb2261808c5345207d5961a6d23c46fb4dd03dcf89a65c2

See more details on using hashes here.

File details

Details for the file danbot_status-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: danbot_status-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 5.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for danbot_status-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3c1456929d972c1ffe6732c3a704b956a06cffbc6b3cbfb063c6e51d8b9d67e2
MD5 4fddc8f8a3c3ddf38d16eb3fa5222e39
BLAKE2b-256 2d0a9bae567fa2a6e154fc874c7abbcf0282bf67a494d98cb22835ff970b532b

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