https://t.me/RX1948
Server : Apache
System : Linux iad1-shared-b8-43 6.6.49-grsec-jammy+ #10 SMP Thu Sep 12 23:23:08 UTC 2024 x86_64
User : dh_edsupp ( 6597262)
PHP Version : 8.2.26
Disable Function : NONE
Directory :  /lib/python3/dist-packages/boto/sqs/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python3/dist-packages/boto/sqs/__pycache__/bigmessage.cpython-310.pyc
o

ckF[y�@s<ddlZddlZddlmZddlmZGdd�de�ZdS)�N)�
RawMessage)�SQSDecodeErrorcsNeZdZdZd�fdd�	Zdd�Zdd�Zd	d
�Zdd�Z�fd
d�Z	�Z
S)�
BigMessagea�
    The BigMessage class provides large payloads (up to 5GB)
    by storing the payload itself in S3 and then placing a reference
    to the S3 object in the actual SQS message payload.

    To create a BigMessage, you should create a BigMessage object
    and pass in a file-like object as the ``body`` param and also
    pass in the an S3 URL specifying the bucket in which to store
    the message body::

        import boto.sqs
        from boto.sqs.bigmessage import BigMessage

        sqs = boto.sqs.connect_to_region('us-west-2')
        queue = sqs.get_queue('myqueue')
        fp = open('/path/to/bigmessage/data')
        msg = BigMessage(queue, fp, 's3://mybucket')
        queue.write(msg)

    Passing in a fully-qualified S3 URL (e.g. s3://mybucket/foo)
    is interpreted to mean that the body of the message is already
    stored in S3 and the that S3 URL is then used directly with no
    content uploaded by BigMessage.
    Ncs||_tt|��||�dS�N)�s3_url�superr�__init__)�self�queue�bodyr��	__class__��5/usr/lib/python3/dist-packages/boto/sqs/bigmessage.pyr8szBigMessage.__init__cCsld}}|r2|�d�r+|dd��dd�}|d}t|�dkr'|dr'|d}||fSd}t||��||fS)Nzs3://��/�rz(s3_url parameter should start with s3://)�
startswith�split�lenr)r	r�bucket_name�key_name�
s3_components�msgrrr�_get_bucket_key<s
�
zBigMessage._get_bucket_keycCs`|�|j�\}}|r|r|jSt��}t��}|�|�}|�|�}|�|�d||f|_|jS)a
        :type value: file-like object
        :param value: A file-like object containing the content
            of the message.  The actual content will be stored
            in S3 and a link to the S3 object will be stored in
            the message body.
        z
s3://%s/%s)	rr�uuid�uuid4�boto�
connect_s3�
get_bucket�new_key�set_contents_from_file)r	�valuerr�s3_conn�	s3_bucket�keyrrr�encodeNs


zBigMessage.encodecCsH|�|�\}}|r|rt��}|�|�}|�|�}|Sd|}t||��)NzUnable to decode S3 URL: %s)rrrr�get_keyr)r	rrrr#r$r%rrrr�_get_s3_objectas


zBigMessage._get_s3_objectcCs||_|�|�}|��Sr)rr(�get_contents_as_string)r	r"r%rrr�decodels
zBigMessage.decodecs,|jr
|�|j�}|��tt|���dSr)rr(�deleterr)r	r%rrrr+qszBigMessage.delete)NNN)�__name__�
__module__�__qualname__�__doc__rrr&r(r*r+�
__classcell__rrrrrsr)rr�boto.sqs.messager�boto.exceptionrrrrrr�<module>s


https://t.me/RX1948 - 2025