Пример #1
0
 def __init__(self, *args, **kwargs):
     super().__init__(*args, **kwargs)
     bot_config = load_config()
     for name in ('users', 'failed_updates'):
         bot_config['storage'][name] = {
             'class': 'util.storage.MemoryStorage'
         }
     self.config = bot_config
Пример #2
0
 def __init__(self):
     config = load_config()
     self.config = config
     super().__init__(
         src_root=realpath(dirname(__file__)),
         urls=self.get_urls(),
         config=config
     )
     self.bot = EvernoteBot(config)
     atexit.register(self.shutdown)
Пример #3
0
 def __init__(self):
     config = load_config()
     webhook_url = 'https://{host}/{token}'.format(
         host=config['host'], token=config['telegram']['token'])
     self.config = config
     super().__init__(src_root=realpath(dirname(__file__)),
                      urls=self.get_urls(),
                      config=config)
     self.bot = EvernoteBot(config)
     atexit.register(self.shutdown)
     self.set_telegram_webhook(webhook_url)
Пример #4
0
from urllib.parse import urlparse

from evernotebot.config import load_config
from evernotebot.web.views import telegram_hook, evernote_oauth

config = load_config()
secret = config["secret"]
webhook_url = config["telegram"]["webhook_url"]
webhook_path = urlparse(webhook_url).path

urls = (
    ("POST", r"^{}$".format(webhook_path), telegram_hook),
    ("GET", r"^/evernote/oauth/{}$".format(secret), evernote_oauth),
)