%PDF- %PDF-
| Direktori : /proc/self/root/proc/thread-self/root/usr/lib/python2.7/site-packages/salt/modules/ |
| Current File : //proc/self/root/proc/thread-self/root/usr/lib/python2.7/site-packages/salt/modules/ifttt.pyo |
�
���^c @@ s� d Z d d l m Z m Z m Z d d l Z d d l Z d d l Z d d l Z e j
e � Z d � Z
d d d d d d � Z d d � Z d S( u�
Support for IFTTT
.. versionadded:: 2015.8.0
Requires an ``api_key`` in ``/etc/salt/minion``:
.. code-block: yaml
ifttt:
secret_key: '280d4699-a817-4719-ba6f-ca56e573e44f'
i ( t absolute_importt print_functiont unicode_literalsNc C@ s0 t d d � r, t d d � r, t d f St S( u5
Only load the module if apache is installed
u
config.getu ifttt.secret_keyu ifttt:secret_keyu* IFTTT Secret Key Unavailable, not loading.( t __salt__t Falset True( ( ( s6 /usr/lib/python2.7/site-packages/salt/modules/ifttt.pyt __virtual__ s
u GETc C@ s� t d d � p t d d � } d j | | � } | d k rN i d d 6} n | d k rg d | d <n t j j j | | d i d
| d | d t d
d d t d t d t d t d t d d �} | S( u#
Make a web call to IFTTT.
u
config.getu ifttt.secret_keyu ifttt:secret_keyu0 https://maker.ifttt.com/trigger/{0}/with/key/{1}u application/jsonu Content-typeu POSTu Acceptt paramst datat header_dictt decodet decode_typeu autot textt statust cookiest persist_sessiont optst backendu requestsN( R t formatt Nonet saltt utilst httpt queryR t __opts__( t eventt methodt argsR R t
secret_keyt patht result( ( s6 /usr/lib/python2.7/site-packages/salt/modules/ifttt.pyt _query% s,
c K@ s� i t d 6d d 6} i } x1 d D]) } | | k r! | | | | j � <q! q! Wt j d
t j � � | d <t d | d
d d t j j j | � � } d | k r� | d d k r� t
| d <| d | d <q� d | k r� | d | d <q� n | S( u�
Trigger a configured event in IFTTT.
:param event: The name of the event to trigger.
:return: A dictionary with status, text, and error if result was failure.
u resultu Something went wrongu messageu value1u value2u value3u Value1u Value2u Value3u %B %d, %Y %I:%M%pu
occurredatR R u POSTR u statusi� u textu error( u value1u value2u value3u Value1u Value2u Value3( R t lowert timet strftimet localtimeR R R t jsont dumpsR ( R t kwargst resR t valueR ( ( s6 /usr/lib/python2.7/site-packages/salt/modules/ifttt.pyt
trigger_eventI s"