
    xh                         d Z ddlZddlZddlmZ 	 ddlmZ n# e$ r	 ddlmZ Y nw xY wddl	m
Z
  G d de          Zd Zed	k    r e             dS dS )
zoA module for sending test SendGrid Inbound Parse messages.
Usage: ./send.py [path to file containing test data]    N)open)Config)Clientc                   0    e Zd Zd Zd Zed             ZdS )Sendc                     || _         dS )z'Create a Send object with target `url`.N_url)selfurls     P/var/www/html/what/lib/python3.11/site-packages/sendgrid/helpers/inbound/send.py__init__zSend.__init__   s    			    c                     ddd}t          | j        |          }t          |dd          }|                                }|                    |          S )	zSend a test payload.

        Load a payload from payload_filepath, apply headers, and POST self.url.
        Return the response object.
        zSendGrid-Testz#multipart/form-data; boundary=xYzZY)z
User-AgentzContent-Type)hostrequest_headersrzutf-8)encoding)request_body)r   r   r   readpost)r   payload_filepathheadersclientfdatas         r   test_payloadzSend.test_payload   sb     *A
 
 TXw???!3999vvxx{{{---r   c                     | j         S )zURL to send to.r	   )r   s    r   r   zSend.url#   s     yr   N)__name__
__module____qualname__r   r   propertyr    r   r   r   r      sM          . . .   X  r   r   c                     t                      } t          j        d          }|                    dt          d           |                    dt          d| j        d	           |                                }t          |j                  }|                    t          j
        d
                   }t          |j                   t          |j                   t          |j                   d S )NzTest data and optional host.)descriptionr   zpath to the sample data)typehelpz-hostz'name of host to send the sample data toF)r&   r'   defaultrequired   )r   argparseArgumentParseradd_argumentstrr   
parse_argsr   r   sysargvprintstatus_coder   body)configparserargssendresponses        r   mainr:   )   s    XXF$24 4 4F
 6  8 8 8  F &e  = = = D	??D  !--H	(
	(
	(-r   __main__)__doc__r+   r0   ior   r5   r   ImportErrorsendgrid.helpers.inbound.configpython_http_clientr   objectr   r:   r   r#   r   r   <module>rB      s   8 8  



      7 7 7 7666666667 & % % % % %    6   6  & zDFFFFF s    ''