예제 #1
0
 def __init__(self):
     if self.token == None:
         tm = TokenManager("Portal", "https://nps.maps.arcgis.com", "IMDGISTeam", "G3010g!c2016", "https://irma.nps.gov")
         tm.getToken()
         self.token = tm.token
     if self.admin == None:
         self.admin = tm.admin
예제 #2
0
 def agsConnection(self, serverURL, agsUser, agsPassword, referer='https://irma.nps.gov'):
     # Requires an admin connection
     tm = TokenManager("AGS", serverURL, agsUser, agsPassword, referer)
     tm.getToken()
     self.token = tm.token
     self.agsServer = tm.admin
예제 #3
0
import telegram # importamos las librerias  
import logging 
from telegram.ext import Updater, CommandHandler, MessageHandler, Filters
from TokenManager import TokenManager

TOKEN = TokenManager.getToken('text_files/secured_token.txt')

bot = telegram.Bot(token=TOKEN)
updater = Updater(token=TOKEN)
dispatcher = updater.dispatcher

# To know when things dont work as expected 
LOG_FILE = 'text_files/lost_err.txt';
logging.basicConfig(filename=LOG_FILE, level=logging.DEBUG, 
                    format='%(asctime)s %(levelname)s %(name)s %(message)s')
logger = logging.getLogger(__name__)

# Functions that contains the actions of the commands when they are pressed
def start(bot, update):
     bot.send_message(chat_id=update.message.chat_id, 
                      text='<b>Lost Wiki</b>.\r\nHere you can find information about the show.',
                      parse_mode=telegram.ParseMode.HTML)
     bot.send_photo(chat_id=update.message.chat_id, photo=open('img/lost1.png', 'rb'))

def character(bot, update): 
     bot.send_message(chat_id=update.message.chat_id, 
                      text='<a href="http://es.lostpedia.wikia.com/wiki/Portal:Personajes_Principales">Main Characters</a>',
                      parse_mode=telegram.ParseMode.HTML)

def description(bot, update):
     bot.send_message(chat_id=update.message.chat_id,