HEX
Server: Apache
System: Linux server2.voipitup.com.au 4.18.0-553.109.1.lve.el8.x86_64 #1 SMP Thu Mar 5 20:23:46 UTC 2026 x86_64
User: posscale (1027)
PHP: 8.2.30
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //opt/saltstack/salt/lib/python3.10/site-packages/salt/utils/__pycache__/slack.cpython-310.pyc
o

�N�gF�@sHdZddlZddlZddlZddlZe�e	�Z
						ddd�ZdS)aN
Library for interacting with Slack API

.. versionadded:: 2016.3.0

:configuration: This module can be used by specifying the name of a
    configuration profile in the minion config, minion pillar, or master
    config.

    For example:

    .. code-block:: yaml

        slack:
          api_key: peWcBiMOS9HrZG15peWcBiMOS9HrZG15
�N�GETc
Cs�ddd�}ddd�ddd�d	d
d�d�}|s3tdd
�p!tdd�}|s3t�d�d|d<d|d<|Sd}	tj�|	d�}
|�|��d�}tj�|
|d�}t|t�sTi}
n|�	�}
|dur^i}|dkrfd|d<d|��|d<t
jjj
|||
|dd||d�}|�dd�tjjkr�|d}|�|��d�}d |vr�|d |d<d|d<|S|�|�|d<|S|�dd�tjjkr�dSt�|�t�|
�t�|�t�|�d|vr�|d}d |vr�|d |d<d|d<|Sd!|d<d|d<|Sd"|d<d|d<|S)#at
    Slack object method function to construct and execute on the API URL.

    :param api_key:     The Slack api key.
    :param function:    The Slack api function to perform.
    :param method:      The HTTP method, e.g. GET or POST.
    :param data:        The data to be sent for POST method.
    :return:            The json response from the API call or False.
    �T)�message�reszconversations.listZchannels)�request�responsez
users.list�memberszchat.postMessageZchannel)ZroomsZusersrz
config.getz
slack.api_keyz
slack:api_keyzNo Slack api key found.rFrzhttps://slack.comz/api/rN�POSTzapplication/jsonZAcceptzBearer Z
Authorization)�params�data�decode�status�header_dict�optsr
�dictr�errorzUnknown responseZinvalid_auth)Z__salt__�logr�urllib�parse�urljoin�get�
isinstancer�copy�salt�utils�http�query�client�OK�
NO_CONTENT�debug)�functionZapi_key�args�methodrrr�retZslack_functionsZapi_urlZbase_url�path�urlZquery_params�resultZ_resultr�r(�D/opt/saltstack/salt/lib/python3.10/site-packages/salt/utils/slack.pyrs~
��

	�



�r)NNrNNN)�__doc__�http.clientr�logging�urllib.parserZsalt.utils.httpr�	getLogger�__name__rrr(r(r(r)�<module>s
�