%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python2.7/site-packages/salt/utils/
Upload File :
Create Path :
Current File : //lib/python2.7/site-packages/salt/utils/pushover.pyc

�
���^c@@s�dZddlmZmZmZddlZddlmZddlm	Z
ddlZddl
mZeje�Zdddddddd	�Zd
�Zd�ZdS(uN
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
i(tabsolute_importtprint_functiontunicode_literalsN(turljoin(t	urlencode(t__version__u1uPOSTcC@s�idd6td6}iidd6dd6d6idd6dd6d	6id
d6dd6d6}	d}
t|
|d
�}|	j|�jd�}t||t�}
|s�i}nt}|dkr�t}ntjjj|
|d|d|d|d|dddtdtdtdtd|�
}|jdd�tj	j
jjj
kr�|	j|�jd�}||kr�||dkr�t|d<n||d<|Sy7d|kr�||dkr�t|d<n||d<Wn%tk
r�t|d<||d<nX|SdS(u�
    PushOver object method function to construct and execute on the API URL.

    :param token:       The PushOver api key.
    :param api_version: The PushOver API version to use, defaults to version 1.
    :param function:    The PushOver 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.
    uumessageuresu
messages.jsonurequestustatusuresponseuusers/validate.jsonu
validate_userusounds.jsonuvalidate_sounduhttps://api.pushover.netu/uDELETEtparamstdatatheader_dicttdecodetdecode_typeujsonttexttstatustcookiestpersist_sessiontoptsiN(tTruet_urljointgettFalsetsalttutilsthttptquerytNonetexttsixtmovesthttp_clienttOKt
ValueError(tfunctionttokentapi_versiontmethodRRtquery_paramsRtrettpushover_functionstapi_urltbase_urltpathturlR	tresulttresponse((s7/usr/lib/python2.7/site-packages/salt/utils/pushover.pyR s`

			'




cC@s9idd6td6}t�}||d<tddddd	|�}|dr5d|kr5|jdd
�}d|kr2|jdi�jdd
�d
kr|jdi�jdd
�}||kr�dj|�|d<t|d<q,dj|�|d<t|d<q/d
j|jdi�jd��|d<q2q5n|S(u�
    Send a message to a Pushover user or group.
    :param sound:       The sound that we want to verify
    :param token:       The PushOver token.
    uSound is invalidumessageuresutokenRuvalidate_soundR"uGETR#uustatusudictiusoundsuValid sound {0}.uWarning: {0} not a valid sound.uerrors(RtdictRRtformatRtjoin(tsoundR R$t
parametersR+t_messagetsounds((s7/usr/lib/python2.7/site-packages/salt/utils/pushover.pytvalidate_soundqs*
	
	
$

1c
C@s idd6td6}t�}||d<||d<|rD||d<ntddd	d
didd
6dt|��}|drd|kr|jdd�}d|kr|jdi�jdd�dkr�t|d<d|d<qt|d<dj|jdi�jd��|d<qqn|S(u�
    Send a message to a Pushover user or group.
    :param user:        The user or group name, either will work.
    :param device:      The device for the user.
    :param token:       The PushOver token.
    uUser key is invalidumessageuresultuuserutokenudeviceRu
validate_userR"uPOSTRu!application/x-www-form-urlencodeduContent-TypeRuresuustatusudictiuUser key is valid.uerrorsN(RR,Rt
_urlencodeRRRR.(tusertdeviceR tresR0R+R1((s7/usr/lib/python2.7/site-packages/salt/utils/pushover.pyt
validate_user�s,	
	




$


1(t__doc__t
__future__RRRtloggingtsalt.ext.six.moves.urllib.parseRRRR4tsalt.ext.six.moves.http_clientRtsalt.versionRt	getLoggert__name__tlogRRR3R8(((s7/usr/lib/python2.7/site-packages/salt/utils/pushover.pyt<module>s J	#

Zerion Mini Shell 1.0