Muffin-Sentry
#############
.. _description:
**Muffin-Sentry** -- Sentry_ Integration for Muffin_ framework
.. _badges:
.. image:: https://github.com/klen/muffin-sentry/workflows/tests/badge.svg
:target: https://github.com/klen/muffin-sentry/actions
:alt: Tests Status
.. image:: https://img.shields.io/pypi/v/muffin-sentry
:target: https://pypi.org/project/muffin-sentry/
:alt: PYPI Version
.. image:: https://img.shields.io/pypi/pyversions/muffin-sentry
:target: https://pypi.org/project/muffin-sentry/
:alt: Python Versions
.. _contents:
.. contents::
.. _requirements:
Requirements
=============
- python >= 3.8
.. _installation:
Installation
=============
**Muffin-Sentry** should be installed using pip: ::
pip install muffin-sentry
.. _usage:
Usage
=====
.. code-block:: python
from muffin import Application
import muffin_sentry
# Create Muffin Application
app = Application('example')
# Initialize the plugin
# As alternative: jinja2 = Jinja2(app, **options)
sentry = muffin_sentry.Plugin()
sentry.setup(app, dsn="DSN_URL")
# Setup custom request processors (coroutines are not supported)
@sentry.processor
def user_scope(event, hint, request):
if request.user:
event['user'] = request.user.email
return event
# Use it inside your handlers
# The exception will be send to Sentry
@app.route('/unhandled')
async def catch_exception(request):
raise Exception('unhandled')
# Capture a message by manual
@app.route('/capture_message')
async def message(request):
sentry.capture_message('a message from app')
return 'OK'
# Capture an exception by manual
@app.route('/capture_exception')
async def exception(request):
sentry.capture_exception(Exception())
return 'OK'
# Update Sentry Scope
@app.route('/update_user')
async def user(request):
scope = sentry.current_scope.get()
scope.set_user({'id': 1, 'email': 'example@example.com'})
sentry.capture_exception(Exception())
return 'OK'
Options
-------
=========================== ======================================= ===========================
Name Default value Desctiption
--------------------------- --------------------------------------- ---------------------------
**dsn** ``""`` Sentry DSN for your application
**sdk_options** ``{}`` Additional options for Sentry SDK Client. See https://docs.sentry.io/platforms/python/configuration/options/
**ignore_errors** ``[ResponseError, ResponseRedirect]`` Exception Types to Ignore
=========================== ======================================= ===========================
You are able to provide the options when you are initiliazing the plugin:
.. code-block:: python
sentry.setup(app, dsn='DSN_URL')
Or setup it inside ``Muffin.Application`` config using the ``SENTRY_`` prefix:
.. code-block:: python
SENTRY_DSN = 'DSN_URL'
``Muffin.Application`` configuration options are case insensitive
.. _bugtracker:
Bug tracker
===========
If you have any suggestions, bug reports or
annoyances please report them to the issue tracker
at https://github.com/klen/muffin-sentry/issues
.. _contributing:
Contributing
============
Development of Muffin-Sentry happens at: https://github.com/klen/muffin-sentry
Contributors
=============
* klen_ (Kirill Klenov)
.. _license:
License
========
Licensed under a `MIT license`_.
.. _links:
.. _klen: https://github.com/klen
.. _Muffin: https://github.com/klen/muffin
.. _Sentry: https://sentry.io/
.. _MIT license: http://opensource.org/licenses/MIT
Raw data
{
"_id": null,
"home_page": "https://github.com/klen/muffin-sentry",
"name": "muffin-sentry",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.9",
"maintainer_email": null,
"keywords": "sentry, asyncio, trio, asgi, muffin",
"author": "Kirill Klenov",
"author_email": "horneds@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/ca/b6/df4b5a197cbbafe1f5dc4b0bccd5376cce0227b62619b4db28f8fcbad6c3/muffin_sentry-1.10.0.tar.gz",
"platform": null,
"description": "Muffin-Sentry\n#############\n\n.. _description:\n\n**Muffin-Sentry** -- Sentry_ Integration for Muffin_ framework\n\n.. _badges:\n\n.. image:: https://github.com/klen/muffin-sentry/workflows/tests/badge.svg\n :target: https://github.com/klen/muffin-sentry/actions\n :alt: Tests Status\n\n.. image:: https://img.shields.io/pypi/v/muffin-sentry\n :target: https://pypi.org/project/muffin-sentry/\n :alt: PYPI Version\n\n.. image:: https://img.shields.io/pypi/pyversions/muffin-sentry\n :target: https://pypi.org/project/muffin-sentry/\n :alt: Python Versions\n\n.. _contents:\n\n.. contents::\n\n.. _requirements:\n\nRequirements\n=============\n\n- python >= 3.8\n\n.. _installation:\n\nInstallation\n=============\n\n**Muffin-Sentry** should be installed using pip: ::\n\n pip install muffin-sentry\n\n.. _usage:\n\nUsage\n=====\n\n.. code-block:: python\n\n from muffin import Application\n import muffin_sentry\n\n # Create Muffin Application\n app = Application('example')\n\n # Initialize the plugin\n # As alternative: jinja2 = Jinja2(app, **options)\n sentry = muffin_sentry.Plugin()\n sentry.setup(app, dsn=\"DSN_URL\")\n\n # Setup custom request processors (coroutines are not supported)\n @sentry.processor\n def user_scope(event, hint, request):\n if request.user:\n event['user'] = request.user.email\n return event\n\n # Use it inside your handlers\n\n # The exception will be send to Sentry\n @app.route('/unhandled')\n async def catch_exception(request):\n raise Exception('unhandled')\n\n # Capture a message by manual\n @app.route('/capture_message')\n async def message(request):\n sentry.capture_message('a message from app')\n return 'OK'\n\n # Capture an exception by manual\n @app.route('/capture_exception')\n async def exception(request):\n sentry.capture_exception(Exception())\n return 'OK'\n\n # Update Sentry Scope\n @app.route('/update_user')\n async def user(request):\n scope = sentry.current_scope.get()\n scope.set_user({'id': 1, 'email': 'example@example.com'})\n sentry.capture_exception(Exception())\n return 'OK'\n\n\nOptions\n-------\n\n=========================== ======================================= =========================== \nName Default value Desctiption\n--------------------------- --------------------------------------- ---------------------------\n**dsn** ``\"\"`` Sentry DSN for your application\n**sdk_options** ``{}`` Additional options for Sentry SDK Client. See https://docs.sentry.io/platforms/python/configuration/options/\n**ignore_errors** ``[ResponseError, ResponseRedirect]`` Exception Types to Ignore\n=========================== ======================================= =========================== \n\nYou are able to provide the options when you are initiliazing the plugin:\n\n.. code-block:: python\n\n sentry.setup(app, dsn='DSN_URL')\n\n\nOr setup it inside ``Muffin.Application`` config using the ``SENTRY_`` prefix:\n\n.. code-block:: python\n\n SENTRY_DSN = 'DSN_URL'\n\n``Muffin.Application`` configuration options are case insensitive\n\n.. _bugtracker:\n\nBug tracker\n===========\n\nIf you have any suggestions, bug reports or\nannoyances please report them to the issue tracker\nat https://github.com/klen/muffin-sentry/issues\n\n.. _contributing:\n\nContributing\n============\n\nDevelopment of Muffin-Sentry happens at: https://github.com/klen/muffin-sentry\n\n\nContributors\n=============\n\n* klen_ (Kirill Klenov)\n\n.. _license:\n\nLicense\n========\n\nLicensed under a `MIT license`_.\n\n.. _links:\n\n\n.. _klen: https://github.com/klen\n.. _Muffin: https://github.com/klen/muffin\n.. _Sentry: https://sentry.io/\n\n.. _MIT license: http://opensource.org/licenses/MIT\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Sentry Integration for Muffin framework",
"version": "1.10.0",
"project_urls": {
"Homepage": "https://github.com/klen/muffin-sentry",
"Repository": "https://github.com/klen/muffin-sentry"
},
"split_keywords": [
"sentry",
" asyncio",
" trio",
" asgi",
" muffin"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "091af0198992ee2930455f434d2ba986582db11b6214cd71139efd63533b9f04",
"md5": "001a51969f4de3faf55466e9fd0a88d7",
"sha256": "f1631495a1de03bfdccfddc9017e3470958f4d0f274ebdfcfc80a9d9315fd2b3"
},
"downloads": -1,
"filename": "muffin_sentry-1.10.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "001a51969f4de3faf55466e9fd0a88d7",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.9",
"size": 4702,
"upload_time": "2024-07-31T14:25:20",
"upload_time_iso_8601": "2024-07-31T14:25:20.866812Z",
"url": "https://files.pythonhosted.org/packages/09/1a/f0198992ee2930455f434d2ba986582db11b6214cd71139efd63533b9f04/muffin_sentry-1.10.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "cab6df4b5a197cbbafe1f5dc4b0bccd5376cce0227b62619b4db28f8fcbad6c3",
"md5": "f481b626695b66b18d8daa3037a04edf",
"sha256": "1cc575f96856d7d673b49b68d4e1399ef7bb171c16e0d9602c627f6c5f07d728"
},
"downloads": -1,
"filename": "muffin_sentry-1.10.0.tar.gz",
"has_sig": false,
"md5_digest": "f481b626695b66b18d8daa3037a04edf",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.9",
"size": 4395,
"upload_time": "2024-07-31T14:25:21",
"upload_time_iso_8601": "2024-07-31T14:25:21.947801Z",
"url": "https://files.pythonhosted.org/packages/ca/b6/df4b5a197cbbafe1f5dc4b0bccd5376cce0227b62619b4db28f8fcbad6c3/muffin_sentry-1.10.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-07-31 14:25:21",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "klen",
"github_project": "muffin-sentry",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "muffin-sentry"
}