Anons79 Mini Shell

Directory : /lib/python2.7/site-packages/ansible/modules/notification/
Upload File :
Current File : //lib/python2.7/site-packages/ansible/modules/notification/nexmo.pyo

�
�Udac@`s�ddlmZmZmZeZidd6dgd6dd6ZdZd	Zdd
l	Z	ddl
mZddlm
Z
dd
lmZmZdZd�Zd�Zedkr�e�nd
S(i(tabsolute_importtdivisiontprint_functions1.1tmetadata_versiontpreviewtstatust	communitytsupported_bys~
module: nexmo
short_description: Send a SMS via nexmo
description:
    - Send a SMS message via nexmo
version_added: 1.6
author: "Matt Martz (@sivel)"
options:
  api_key:
    description:
      - Nexmo API Key
    required: true
  api_secret:
    description:
      - Nexmo API Secret
    required: true
  src:
    description:
       - Nexmo Number to send from
    required: true
  dest:
    description:
      - Phone number(s) to send SMS message to
    required: true
  msg:
    description:
      - Message to text to send. Messages longer than 160 characters will be
        split into multiple messages
    required: true
  validate_certs:
    description:
      - If C(no), SSL certificates will not be validated. This should only be used
        on personally controlled sites using self-signed certificates.
    type: bool
    default: 'yes'
extends_documentation_fragment:
  - url
s�
- name: Send notification message via Nexmo
  nexmo:
    api_key: 640c8a53
    api_secret: 0ce239a6
    src: 12345678901
    dest:
      - 10987654321
      - 16789012345
    msg: '{{ inventory_hostname }} completed'
  delegate_to: localhost
N(t	urlencode(t
AnsibleModule(t	fetch_urlturl_argument_specshttps://rest.nexmo.com/sms/jsonc

C`s�t�}t�}i|jjd�d6|jjd�d6|jjd�d6|jjd�d6}xx|jjd�D]d}||d<d	tt|�f}td
d�}t||d|�\}}|d
dkr�|j|�tdt�||<nyt	j
|�||<Wn1tk
rD|j|�tdt�||<nZXxV||dD]F}	t|	d
�dkrT|j|�tdt||�||<qTqTW|r�d}nd}|j
dt|�d|dtd|�qwWdS(Ntapi_keyt
api_secrettsrctfromtmsgttexttdestttos%s?%stAcceptsapplication/jsontheadersRi�tfailedtmessagesisOne or messages failed to sendttchangedt	responses(tlisttdicttparamstgett	NEXMO_APIRR
tappendtTruetjsontloadt	Exceptiontintt	exit_jsontbooltFalse(
tmoduleRRRtnumberturlRtresponsetinfotmessage((sF/usr/lib/python2.7/site-packages/ansible/modules/notification/nexmo.pytsend_msgMs:		




!	!cC`s�t�}|jtdtdtdt�dtdtdt�dtdtdd�dtdtdd	�d
tdt���td|�}t|�dS(NRtrequiredtno_logR
RttypeR%RRRt
argument_spec(RtupdateRR!R	R/(R3R)((sF/usr/lib/python2.7/site-packages/ansible/modules/notification/nexmo.pytmaints		t__main__(t
__future__RRRR2t
__metaclass__tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLESR"t+ansible.module_utils.six.moves.urllib.parseRtansible.module_utils.basicR	tansible.module_utils.urlsR
RRR/R5t__name__(((sF/usr/lib/python2.7/site-packages/ansible/modules/notification/nexmo.pyt<module>s


(
	'	

Anons79 File Manager Version 1.0, Coded By Anons79
Email: [email protected]