%PDF- %PDF-
Direktori : /usr/lib/python2.7/site-packages/salt/utils/ |
Current File : //usr/lib/python2.7/site-packages/salt/utils/pushover.pyc |
� ���^c @@ s� d Z d d l m Z m Z m Z d d l Z d d l m Z d d l m Z d d l Z d d l m Z e j e � Z d d d d d d d d � Z d � Z d � Z d S( 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 ( t absolute_importt print_functiont unicode_literalsN( t urljoin( t urlencode( t __version__u 1u POSTc C@ s� i d d 6t d 6} i i d d 6d d 6d 6i d d 6d d 6d 6i d d 6d d 6d 6} d } t | | d � } | j | � j d � } t | | t � } | s� i } n t } | d k r� t } n t j j j | | d | d | d | d | d d d t d t d t d t d | � } | j d d � t j j j j j k r�| j | � j d � } | | k r�| | d k r�t | d <n | | d <| Sy7 d | k r�| | d k r�t | d <n | | d <Wn% t k r�t | d <| | d <n X| Sd S( 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. u u messageu resu messages.jsonu requestu statusu responseu users/validate.jsonu validate_useru sounds.jsonu validate_soundu https://api.pushover.netu /u DELETEt paramst datat header_dictt decodet decode_typeu jsont textt statust cookiest persist_sessiont optsi N( t Truet _urljoint gett Falset saltt utilst httpt queryt Nonet extt sixt movest http_clientt OKt ValueError( t functiont tokent api_versiont methodR R t query_paramsR t rett pushover_functionst api_urlt base_urlt patht urlR t resultt response( ( s7 /usr/lib/python2.7/site-packages/salt/utils/pushover.pyR s` ' c C@ s9 i d d 6t d 6} t � } | | d <t d d d d d | � } | d r5d | k r5| j d d � } d | k r2| j d i � j d d � d k r| j d i � j d d � } | | k r� d j | � | d <t | d <q,d j | � | d <t | d <q/d j | j d i � j d � � | 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. u Sound is invalidu messageu resu tokenR u validate_soundR"