Skip to main content

Async API wrapper around discordstatus.com

Project description

DiscordStatusPy - async API wrapper around discordstatus

Requirements:

Tested with the stack below. May or may not work on other versions.

  • Python 3.9.6
  • AIOHTTP 3.7.4

Usage:

Example 1:

import asyncio
import DiscordStatusPy

async def main():
    # With suppress_exc we will suppress all raised exceptions and return None
    maintenances = await DiscordStatusPy.get_maintenances(suppress_exc=True)
    print(maintenances['scheduled_maintenances'])

asyncio.run(main())

While you can access the API via the appropriate functions, it's better performance-wise if you use the APIClient class, especially if you're making multiple calls.

Always close connection when you don't need your APIClient instance anymore. For that call its close method:

await my_client.close()

Or use an async content manager which will do that for you:

async with APIClient() as client:
    # Do stuff
# Now it's closed

Example 2:

import asyncio
from DiscordStatusPy import APIClient

async def main():
    # With check_content_type we will check response’s content type
    async with APIClient(check_content_type=True) as client:
        status = await client.get_status()
        incidents = await client.get_incidents()
        print(status['status']['description'])
        print(incidents)

    # Alternatively (less desirable)
    client = APIClient()
    components = await client.get_components()
    print(components)
    await client.close()

asyncio.run(main())

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

DiscordStatusPy-0.0.1.tar.gz (17.1 kB view details)

Uploaded Source

Built Distribution

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

DiscordStatusPy-0.0.1-py3-none-any.whl (17.5 kB view details)

Uploaded Python 3

File details

Details for the file DiscordStatusPy-0.0.1.tar.gz.

File metadata

  • Download URL: DiscordStatusPy-0.0.1.tar.gz
  • Upload date:
  • Size: 17.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.1 CPython/3.9.6

File hashes

Hashes for DiscordStatusPy-0.0.1.tar.gz
Algorithm Hash digest
SHA256 a8e420f70baabdb7d99b40fe04bb6ab2174a63ff3bae072f56abc25a3fd07385
MD5 4caefb74ef6f4c0a285db6ba65424767
BLAKE2b-256 3cb3a4eea99e822b0aa3e7fa7f144d36c72a767d3ef105acfdb6527777f8f098

See more details on using hashes here.

File details

Details for the file DiscordStatusPy-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: DiscordStatusPy-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 17.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.1 CPython/3.9.6

File hashes

Hashes for DiscordStatusPy-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c9cdd12553f079171bad84372b1f8a9da68dec6eeec140d0560864cfc14a2c16
MD5 64ce2da76f69a5aa070f1397760291a7
BLAKE2b-256 9ee3d4c5dc4eafa1355c574c9d3ce093561ca984e7bec5b03f103304c7c91232

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