Current Path: > > opt > > hc_python > lib > python3.12 > > site-packages > > sentry_sdk
Operation : Linux premium131.web-hosting.com 4.18.0-553.44.1.lve.el8.x86_64 #1 SMP Thu Mar 13 14:29:12 UTC 2025 x86_64 Software : Apache Server IP : 162.0.232.56 | Your IP: 216.73.216.111 Domains : 1034 Domain(s) Permission : [ 0755 ]
Name | Type | Size | Last Modified | Actions |
---|---|---|---|---|
__pycache__ | Directory | - | - | |
ai | Directory | - | - | |
crons | Directory | - | - | |
integrations | Directory | - | - | |
profiler | Directory | - | - | |
__init__.py | File | 1215 bytes | May 23 2025 10:34:44. | |
_compat.py | File | 3116 bytes | May 23 2025 10:34:44. | |
_init_implementation.py | File | 2559 bytes | May 23 2025 10:34:44. | |
_log_batcher.py | File | 5085 bytes | May 23 2025 10:34:44. | |
_lru_cache.py | File | 1229 bytes | May 23 2025 10:34:44. | |
_queue.py | File | 11250 bytes | May 23 2025 10:34:44. | |
_types.py | File | 10462 bytes | May 23 2025 10:34:44. | |
_werkzeug.py | File | 3734 bytes | May 23 2025 10:34:44. | |
api.py | File | 11866 bytes | May 23 2025 10:34:44. | |
attachments.py | File | 3109 bytes | May 23 2025 10:34:44. | |
client.py | File | 38029 bytes | May 23 2025 10:34:44. | |
consts.py | File | 40631 bytes | May 23 2025 10:34:44. | |
debug.py | File | 1019 bytes | May 23 2025 10:34:44. | |
envelope.py | File | 10355 bytes | May 23 2025 10:34:44. | |
feature_flags.py | File | 2233 bytes | May 23 2025 10:34:44. | |
hub.py | File | 25675 bytes | May 23 2025 10:34:44. | |
logger.py | File | 1656 bytes | May 23 2025 10:34:44. | |
metrics.py | File | 29913 bytes | May 23 2025 10:34:44. | |
monitor.py | File | 3710 bytes | May 23 2025 10:34:44. | |
py.typed | File | 0 bytes | May 23 2025 10:34:44. | |
scope.py | File | 63332 bytes | May 23 2025 10:34:44. | |
scrubber.py | File | 6064 bytes | May 23 2025 10:34:44. | |
serializer.py | File | 13087 bytes | May 23 2025 10:34:44. | |
session.py | File | 5571 bytes | May 23 2025 10:34:44. | |
sessions.py | File | 9181 bytes | May 23 2025 10:34:44. | |
spotlight.py | File | 8678 bytes | May 23 2025 10:34:44. | |
tracing.py | File | 48114 bytes | May 23 2025 10:34:44. | |
tracing_utils.py | File | 28820 bytes | May 23 2025 10:34:44. | |
transport.py | File | 32604 bytes | May 23 2025 10:34:44. | |
types.py | File | 1222 bytes | May 23 2025 10:34:44. | |
utils.py | File | 59368 bytes | May 23 2025 10:34:44. | |
worker.py | File | 4464 bytes | May 23 2025 10:34:44. |
import os import mimetypes from sentry_sdk.envelope import Item, PayloadRef from typing import TYPE_CHECKING if TYPE_CHECKING: from typing import Optional, Union, Callable class Attachment: """Additional files/data to send along with an event. This class stores attachments that can be sent along with an event. Attachments are files or other data, e.g. config or log files, that are relevant to an event. Attachments are set on the ``Scope``, and are sent along with all non-transaction events (or all events including transactions if ``add_to_transactions`` is ``True``) that are captured within the ``Scope``. To add an attachment to a ``Scope``, use :py:meth:`sentry_sdk.Scope.add_attachment`. The parameters for ``add_attachment`` are the same as the parameters for this class's constructor. :param bytes: Raw bytes of the attachment, or a function that returns the raw bytes. Must be provided unless ``path`` is provided. :param filename: The filename of the attachment. Must be provided unless ``path`` is provided. :param path: Path to a file to attach. Must be provided unless ``bytes`` is provided. :param content_type: The content type of the attachment. If not provided, it will be guessed from the ``filename`` parameter, if available, or the ``path`` parameter if ``filename`` is ``None``. :param add_to_transactions: Whether to add this attachment to transactions. Defaults to ``False``. """ def __init__( self, bytes=None, # type: Union[None, bytes, Callable[[], bytes]] filename=None, # type: Optional[str] path=None, # type: Optional[str] content_type=None, # type: Optional[str] add_to_transactions=False, # type: bool ): # type: (...) -> None if bytes is None and path is None: raise TypeError("path or raw bytes required for attachment") if filename is None and path is not None: filename = os.path.basename(path) if filename is None: raise TypeError("filename is required for attachment") if content_type is None: content_type = mimetypes.guess_type(filename)[0] self.bytes = bytes self.filename = filename self.path = path self.content_type = content_type self.add_to_transactions = add_to_transactions def to_envelope_item(self): # type: () -> Item """Returns an envelope item for this attachment.""" payload = None # type: Union[None, PayloadRef, bytes] if self.bytes is not None: if callable(self.bytes): payload = self.bytes() else: payload = self.bytes else: payload = PayloadRef(path=self.path) return Item( payload=payload, type="attachment", content_type=self.content_type, filename=self.filename, ) def __repr__(self): # type: () -> str return "<Attachment %r>" % (self.filename,)
SILENT KILLER Tool