Server IP : 66.29.132.122 / Your IP : 3.142.199.3 Web Server : LiteSpeed System : Linux business142.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64 User : admazpex ( 531) PHP Version : 7.2.34 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /proc/self/root/proc/self/root/proc/thread-self/root/proc/thread-self/root/proc/self/root/proc/thread-self/root/proc/self/root/proc/self/root/proc/self/root/proc/self/root/opt/alt/python37/lib/python3.7/site-packages/raven/contrib/django/management/commands/ |
Upload File : |
""" raven.contrib.django.management.commands.raven ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :copyright: (c) 2010-2016 by the Sentry Team, see AUTHORS for more details :license: BSD, see LICENSE for more details. """ from __future__ import absolute_import, print_function from django.core.management.base import BaseCommand from optparse import make_option from raven.scripts.runner import store_json, send_test_message import argparse import django import json import sys import time DJANGO_18 = django.VERSION >= (1, 8, 0) class StoreJsonAction(argparse.Action): def __call__(self, parser, namespace, values, option_string=None): try: value = json.loads(values[0]) except ValueError: print("Invalid JSON was used for option %s. Received: %s" % (self.dest, values[0])) sys.exit(1) setattr(namespace, self.dest, value) class Command(BaseCommand): help = 'Commands to interact with the Sentry client' if not DJANGO_18: option_list = BaseCommand.option_list + ( make_option( '--data', action='callback', callback=store_json, type='string', nargs=1, dest='data'), make_option( '--tags', action='callback', callback=store_json, type='string', nargs=1, dest='tags'), ) else: def add_arguments(self, parser): parser.add_argument( 'command', nargs=1, ) parser.add_argument( '--data', action=StoreJsonAction, nargs=1, dest='data', ) parser.add_argument( '--tags', action=StoreJsonAction, nargs=1, dest='tags', ) def handle(self, command=None, *args, **options): if command not in ('test', ['test']): print('Usage: manage.py raven test') sys.exit(1) from raven.contrib.django.models import client send_test_message(client, { 'tags': options.get('tags'), 'data': options.get('data'), }) time.sleep(3)