
    Ii                     ,    S SK r SSS.r " S S\5      rg)    Nzhttps://api.eu.sendgrid.comzhttps://api.sendgrid.com)euglobalc                   <    \ rS rSrS r\S 5       rS rS rS r	Sr
g)	BaseInterface   c                     SSK Jn  Xl        X0l        X@l        SR                  U R                  5      U l        X l        [        R                  " U R                  U R                  SS9U l        g)a  
Construct the Twilio SendGrid v3 API object.
Note that the underlying client is being set up during initialization,
therefore changing attributes in runtime will not affect HTTP client
behaviour.

:param auth: the authorization header
:type auth: string
:param impersonate_subuser: the subuser to impersonate. Will be passed
                            by "On-Behalf-Of" header by underlying
                            client. See
                            https://sendgrid.com/docs/User_Guide/Settings/subusers.html
                            for more details
:type impersonate_subuser: string
:param host: base URL for API calls
:type host: string
   )__version__zsendgrid/{};python   hostrequest_headersversionN) r
   authimpersonate_subuserr   format	useragentr   python_http_clientClient_default_headersclient)selfr   r   r   r
   s        =/venv/lib/python3.13/site-packages/sendgrid/base_interface.py__init__BaseInterface.__init__   sW    $ 	"	#6 "-44T\\B	(// 11    c                 z    U R                   U R                  SS.nU R                  (       a  U R                  US'   U$ )z8Set the default header for a Twilio SendGrid v3 API callzapplication/json)Authorizationz
User-AgentAcceptzOn-Behalf-Of)r   r   r   )r   headerss     r   r   BaseInterface._default_headers$   s<     "YY..(

 ##&*&>&>GN#r   c                 :    U R                   U R                  l        g )N)r   r   r   )r   s    r   reset_request_headers#BaseInterface.reset_request_headers1   s    &*&;&;#r   c                     [        U[        5      (       d  UR                  5       nU R                  R                  R
                  R                  US9$ )zMake a Twilio SendGrid v3 API request with the request body generated by
   the Mail object

:param message: The Twilio SendGrid v3 API request body generated by the Mail
                object
:type message: Mail
)request_body)
isinstancedictgetr   mailsendpost)r   messages     r   r,   BaseInterface.send4   s@     '4((kkmG{{$$))w)??r   c                     U[         R                  5       ;   aL  [         U   U l        U R                  b0  [        R
                  " U R                  U R                  SS9U l        gg[        S5      e)ay  
Client libraries contain setters for specifying region/edge.
This supports global and eu regions only. This set will likely expand in the future.
Global is the default residency (or region)
Global region means the message will be sent through https://api.sendgrid.com
EU region means the message will be sent through https://api.eu.sendgrid.com
:param region: string
:return:
Nr   r   z#region can only be "eu" or "global")region_host_dictkeysr   r   r   r   r   
ValueError)r   regions     r   set_sendgrid_data_residency)BaseInterface.set_sendgrid_data_residencyA   sf     %**,,(0DI$$0077$($9$9 1 FGGr   )r   r   r   r   r   r   N)__name__
__module____qualname____firstlineno__r   propertyr   r$   r,   r5   __static_attributes__ r   r   r   r      s,    < 
 
<@Hr   r   )r   r1   objectr   r=   r   r   <module>r?      s$    6@Z[ NHF NHr   