update examples

This commit is contained in:
leandrotoledo 2015-07-14 04:31:20 -03:00
parent b83a659bc2
commit 7d8fcc5fb9
2 changed files with 5 additions and 5 deletions

View file

@ -6,7 +6,7 @@ import telegram
import time import time
# Telegram Bot Authorization Token # Telegram Bot Authorization Token
bot = telegram.Bot('token') bot = telegram.Bot('TOKEN')
# This will be our global variable to keep the latest update_id when requesting # This will be our global variable to keep the latest update_id when requesting
# for updates. It starts with the latest update_id available. # for updates. It starts with the latest update_id available.
@ -35,4 +35,4 @@ def echo():
if __name__ == '__main__': if __name__ == '__main__':
while True: while True:
echo() echo()
time.sleep(5) time.sleep(3)

View file

@ -6,11 +6,11 @@
__author__ = 'leandrotoledodesouza@gmail.com' __author__ = 'leandrotoledodesouza@gmail.com'
import telegram import telegram
import requests import urllib
def main(): def main():
bot = telegram.Bot('token') # Telegram Bot Authorization Token bot = telegram.Bot('TOKEN') # Telegram Bot Authorization Token
global LAST_UPDATE_ID global LAST_UPDATE_ID
LAST_UPDATE_ID = bot.getUpdates()[-1].update_id # Get lastest update LAST_UPDATE_ID = bot.getUpdates()[-1].update_id # Get lastest update
@ -31,7 +31,7 @@ def main():
def ed(text): def ed(text):
url = 'http://www.ed.conpet.gov.br/mod_perl/bot_gateway.cgi?server=0.0.0.0%3A8085&charset_post=utf-8&charset=utf-8&pure=1&js=0&tst=1&msg=' + text url = 'http://www.ed.conpet.gov.br/mod_perl/bot_gateway.cgi?server=0.0.0.0%3A8085&charset_post=utf-8&charset=utf-8&pure=1&js=0&tst=1&msg=' + text
data = requests.get(url).content data = urllib.urlopen(url).read()
return data.strip() return data.strip()