Anons79 Mini Shell

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

�
�Udac@`s�ddlmZmZmZeZidd6dgd6dd6ZdZd	Zd
Z	ddl
Z
ddlmZdd
l
mZddlmZd�Zedkr�e�ndS(i(tabsolute_importtdivisiontprint_functions1.1tmetadata_versiontpreviewtstatust	communitytsupported_bys�

module: telegram
version_added: "2.2"
author: "Artem Feofanov (@tyouxa)"

short_description: module for sending notifications via telegram

description:
    - Send notifications via telegram bot, to a verified group or user
notes:
    - You will require a telegram account and create telegram bot to use this module.
options:
  msg:
    description:
      - What message you wish to send.
    required: true
  msg_format:
    description:
      - Message format. Formatting options `markdown` and `html` described in
        Telegram API docs (https://core.telegram.org/bots/api#formatting-options).
        If option `plain` set, message will not be formatted.
    default: plain
    choices: [ "plain", "markdown", "html" ]
    version_added: "2.4"
  token:
    description:
      - Token identifying your telegram bot.
    required: true
  chat_id:
    description:
      - Telegram group or user chat_id
    required: true

s�

- name: send a message to chat in playbook
  telegram:
    token: '9999999:XXXXXXXXXXXXXXXXXXXXXXX'
    chat_id: 000000
    msg: Ansible task finished
s

msg:
  description: The message you attempted to send
  returned: success
  type: str
  sample: "Ansible task finished"
telegram_error:
  description: Error message gotten from Telegram API
  returned: failure
  type: str
  sample: "Bad Request: message text is empty"
N(t
AnsibleModule(tquote(t	fetch_urlc	C`s�tdtdtdddtdt�dtdddtdt�dtdddtd	d
dd
dd
g�dtdddt��dt�}t|jjd��}t|jjd��}t|jjd��}t|jjd��}d|d|d|}|dkr$|d|7}n|jr@|jdt�nt	||�\}}|ddkrx|jdt�n;t
j|d�}|jddt
|d�d|d�dS(Nt
argument_specttokenttypetstrtrequiredtno_logtchat_idt
msg_formattdefaulttplaintchoicestmarkdownthtmltmsgtsupports_check_modeshttps://api.telegram.org/bots/sendMessage?text=s	&chat_id=s&parse_mode=tchangedRi�tbodys(failed to send message, return status=%sttelegram_errortdescription(RR(RtdicttTruetFalseR	tparamstgett
check_modet	exit_jsonR
tjsontloadst	fail_jsonR(	tmoduleRRRRturltresponsetinfoR((sI/usr/lib/python2.7/site-packages/ansible/modules/notification/telegram.pytmainRs.		t__main__(t
__future__RRRR
t
__metaclass__tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNR%tansible.module_utils.basicRt+ansible.module_utils.six.moves.urllib.parseR	tansible.module_utils.urlsR
R,t__name__(((sI/usr/lib/python2.7/site-packages/ansible/modules/notification/telegram.pyt<module>s


%		"

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