File: //opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/__pycache__/mandrill.cpython-310.pyc
o
�N�g: � @ s� d Z ddlZddlZddlZzddlZdZW n ey! dZY nw dZe� e
�ZdZdZ
dd � Zd
d� Zddd
�Zdd� Zdd� Zddd�Z ddd�ZdS )a&
Mandrill
========
Send out emails using the Mandrill_ API_.
.. _Mandrill: https://mandrillapp.com
.. _API: https://mandrillapp.com/api/docs/
In the minion configuration file, the following block is required:
.. code-block:: yaml
mandrill:
key: <API_KEY>
.. versionadded:: 2018.3.0
� NTF�mandrillzhttps://mandrillapp.com/api� c C s t du rdS tS )z2
Return the execution module virtualname.
F)FzIThe requests python package is required for the mandrill execution module)�HAS_REQUESTS�__virtualname__� r r �I/opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/mandrill.py�__virtual__( s r c C s dddd�S )z&
Default dictionary returned.
F� N)�result�comment�outr r r r r �_default_ret4 s r
c C sF t d d�}|s
i }| p|�d�pt|p|�d�|p |�d�p td�S )z7
Retrieve the API params from the config file.
zconfig.merger �api_url�key�api_version)r �api_keyr )Z__salt__�get�BASE_URL�DEFAULT_VERSION)r r r Zmandrill_cfgr r r �_get_api_params; s ��r c C s dj |t|�| d�S )z
Build the API URL.
z{url}/{version}/{method}.json)�url�version�method)�format�float)r r r r r r �_get_urlK s
�r c C s
ddd�S )z<
Return HTTP headers required for the Mandrill API.
zapplication/jsonzMandrill-Python/1.0.57)zcontent-typez
user-agentr r r r r �_get_headersT s
r c C s� |st � }t�� }t�d| � |j| |tjj� |�d�}|�� }t
� }t�d|j� t�d� t�|� |jdkrY|jdkrL|�dd�|d <