Skip to main content

Seamlessly Send Django or Python Exceptions to Discord Channels!

Project description

A Django app to send any exception to a Discord channel.

Quick start

Installation

You can install django-alert-winglet using pip::

pip install django-alert-winglet

  1. Add “alert_winglet” to your INSTALLED_APPS setting in your Django project’s settings file:

    INSTALLED_APPS = [
        ...,
        "alert_winglet",
    ]

Discord

  1. Set the DISCORD_WEBHOOK_URL variable in your Django settings. This is the URL of the Discord webhook you want to use for sending exceptions.

  2. Use the DiscordEmbedManager class to create a Discord Embed object.

    from alert_winglet.discord.manager import DiscordEmbedManager
    
    # If the request is not provided, the `extra_detail` variable will be None
    discord_manager = DiscordEmbedManager(
          exc,
      )
    formatted_exc, extra_detail = discord_manager.format_exception()
    data = discord_manager.prepare_embed_data(formatted_exc, extra_detail)

3. Then use the DiscordDelivery class to send the exception to your Discord channel using the webhook. This class can be used for other purposes as well, like sending messages or files… .

from alert_winglet.discord.sender import DiscordDelivery

delivery = DiscordDelivery(
    embeds=[
        data,
    ]
)
delivery.send()

Requirements

  • django >= 3.0

  • discord.py >=2.2.3

  • requests >=2.28.2

License

This project is licensed under the MIT License.

Bug Reports and Feature Requests

Please use the GitHub_issue tracker to report any bugs or submit feature requests.

Authors

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

django-alert-winglet-0.1.8.tar.gz (8.1 kB view details)

Uploaded Source

File details

Details for the file django-alert-winglet-0.1.8.tar.gz.

File metadata

  • Download URL: django-alert-winglet-0.1.8.tar.gz
  • Upload date:
  • Size: 8.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for django-alert-winglet-0.1.8.tar.gz
Algorithm Hash digest
SHA256 6432ffe5102b428370fc797dc7f505ba60c02ebbc820163a4995c228e3fb391f
MD5 78cfbbf5480a3ffe36f7f713df49839a
BLAKE2b-256 b519b01bb00277185b5c89200075cb01d35df14520fb8edbcb2938f2a4685bb2

See more details on using hashes here.

Provenance

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