[ Avaa Bypassed ]




Upload:

Command:

hmhc3928@18.223.203.6: ~ $
import os
import mimetypes

from sentry_sdk._types import MYPY
from sentry_sdk.envelope import Item, PayloadRef

if MYPY:
    from typing import Optional, Union, Callable


class Attachment(object):
    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,)

Filemanager

Name Type Size Permission Actions
__pycache__ Folder 0755
integrations Folder 0755
__init__.py File 854 B 0644
_compat.py File 2.3 KB 0644
_functools.py File 2.22 KB 0644
_queue.py File 8.21 KB 0644
_types.py File 1.26 KB 0644
api.py File 4.69 KB 0644
attachments.py File 1.75 KB 0644
client.py File 14.03 KB 0644
consts.py File 3.5 KB 0644
debug.py File 1.11 KB 0644
envelope.py File 8.17 KB 0644
hub.py File 21.35 KB 0644
py.typed File 0 B 0644
scope.py File 15.62 KB 0644
serializer.py File 15.92 KB 0644
sessions.py File 7.67 KB 0644
tracing.py File 25.24 KB 0644
transport.py File 11.48 KB 0644
utils.py File 26.26 KB 0644
worker.py File 3.87 KB 0644