o
    t¨ÊhU  ã                   @   sÜ   d Z ddlZddlZzddlmZ W n ey!   ddlmZ Y nw ddlmZ G dd„ de	ƒZ
eƒ Zejdd�Zejd	ed
d� ejdedejdd� e ¡ Ze
ejƒZe ejd ¡Zeejƒ eejƒ eejƒ dS )znA module for sending test SendGrid Inbound Parse messages
Usage: ./send.py [path to file containing test data]é    N)ÚConfig)ÚClientc                   @   s(   e Zd Zdd„ Zdd„ Zedd„ ƒZdS )ÚSendc                 C   s
   || _ d S ©N©Ú_url)ÚselfÚurl© r
   úO/var/www/html/env/lib/python3.10/site-packages/sendgrid/helpers/inbound/send.pyÚ__init__   s   
zSend.__init__c                 C   s6   dddœ}t | j|d�}t|dƒ}| ¡ }|j|d�S )NzSendGrid-Testz#multipart/form-data; boundary=xYzZY)z
User-AgentzContent-Type)ÚhostÚrequest_headersÚr)Úrequest_body)r   r	   ÚopenÚreadÚpost)r   Úpayload_filepathÚheadersÚclientÚfÚdatar
   r
   r   Útest_payload   s   þ
zSend.test_payloadc                 C   s   | j S r   r   )r   r
   r
   r   r	      s   zSend.urlN)Ú__name__Ú
__module__Ú__qualname__r   r   Úpropertyr	   r
   r
   r
   r   r      s
    
r   z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é   )Ú__doc__ÚargparseÚsysÚconfigr   ÚImportErrorÚsendgrid.helpers.inbound.configÚpython_http_clientr   Úobjectr   ÚArgumentParserÚparserÚadd_argumentÚstrr   Ú
parse_argsÚargsÚsendr   ÚargvÚresponseÚprintÚstatus_coder   Úbodyr
   r
   r
   r   Ú<module>   s6    þþý


