示例#1
0
def openshift_app():
    import os

    bot = setup(
        db_url='postgresql://%s:%s/pplwarebot' % (os.environ['OPENSHIFT_POSTGRESQL_DB_HOST'], os.environ['OPENSHIFT_POSTGRESQL_DB_PORT']),
        token=os.environ['TELEGRAM_KEY']
    )
    bot.set_webhook('https://%s/update/%s' % (os.environ['OPENSHIFT_APP_DNS'], bot._token))

    from tgbot.webserver import wsgi_app
    return wsgi_app(bot)
示例#2
0
def openshift_app():
    import os

    bot = setup(
        'postgresql://%s:%s/%s' %
        (os.environ['OPENSHIFT_POSTGRESQL_DB_HOST'],
         os.environ['OPENSHIFT_POSTGRESQL_DB_PORT'], os.environ['PGDATABASE']),
        os.environ['TGTOKEN'], 'https://%s' % os.environ['OPENSHIFT_APP_DNS'])
    bot.set_webhook('https://%s/update/%s' %
                    (os.environ['OPENSHIFT_APP_DNS'], bot.token))

    return extend_webapp(wsgi_app([bot]), bot)
示例#3
0
def openshift_app():
    import os

    bot = setup(
        db_url='postgresql://%s:%s/%s' %
        (os.environ['OPENSHIFT_POSTGRESQL_DB_HOST'],
         os.environ['OPENSHIFT_POSTGRESQL_DB_PORT'], os.environ['PGDATABASE']),
        token=os.environ['TGTOKEN'])
    bot.set_webhook('https://%s/update/%s' %
                    (os.environ['OPENSHIFT_APP_DNS'], bot.token))

    from tgbot.webserver import wsgi_app
    return wsgi_app([bot])
示例#4
0
def openshift_app():
    import os

    bot = setup(
        'postgresql://%s:%s/%s' % (
            os.environ['OPENSHIFT_POSTGRESQL_DB_HOST'],
            os.environ['OPENSHIFT_POSTGRESQL_DB_PORT'],
            os.environ['PGDATABASE']
        ),
        os.environ['TGTOKEN'],
        'https://%s' % os.environ['OPENSHIFT_APP_DNS']
    )
    bot.set_webhook('https://%s/update/%s' % (os.environ['OPENSHIFT_APP_DNS'], bot.token))

    return extend_webapp(wsgi_app([bot]), bot)
示例#5
0
def openshift_app():
    import os

    bot = setup(
        db_url='postgresql://%s:%s/%s' % (
            os.environ['OPENSHIFT_POSTGRESQL_DB_HOST'],
            os.environ['OPENSHIFT_POSTGRESQL_DB_PORT'],
            os.environ['PGDATABASE']
        ),
        token=os.environ['TGTOKEN']
    )
    bot.set_webhook('https://%s/update/%s' % (os.environ['OPENSHIFT_APP_DNS'], bot.token))

    from tgbot.webserver import wsgi_app
    return wsgi_app([bot])
示例#6
0
def main(args=None):
    args = parse_args(args)

    tg = setup(args.db_url, args.token, args.webhook[0])

    if args.list:
        tg.print_commands()
        return

    if args.create_db:
        tg.setup_db()
        print 'DB created'
        return

    tg.set_webhook('%s/update/%s' % (args.webhook[0], tg.token))
    extend_webapp(wsgi_app([tg]), tg).run(host='0.0.0.0', port=int(args.webhook[1]))
def openshift_app():
    import os

    bot = setup(
        db_url="postgresql://%s:%s/%s"
        % (
            os.environ["OPENSHIFT_POSTGRESQL_DB_HOST"],
            os.environ["OPENSHIFT_POSTGRESQL_DB_PORT"],
            os.environ["PGDATABASE"],
        ),
        token=os.environ["TGTOKEN"],
    )
    bot.set_webhook("https://%s/update/%s" % (os.environ["OPENSHIFT_APP_DNS"], bot.token))

    from tgbot.webserver import wsgi_app

    return wsgi_app([bot])
示例#8
0
def main(args=None):
    args = parse_args(args)

    tg = setup(args.db_url, args.token, args.webhook[0])

    if args.list:
        tg.print_commands()
        return

    if args.create_db:
        tg.setup_db()
        print 'DB created'
        return

    tg.set_webhook('%s/update/%s' % (args.webhook[0], tg.token))
    extend_webapp(wsgi_app([tg]), tg).run(host='0.0.0.0',
                                          port=int(args.webhook[1]))
 def setUp(self):
     self.bot = self.prepare_bot(bot=millionsbot.setup('sqlite:///:memory:', '123'))
     self.bot.setup_db()
     self.webapp = webtest.TestApp(webserver.wsgi_app([self.bot]))
     self.received_id = 1
示例#10
0
 def setUp(self):
     self.bot = self.prepare_bot(priberambot.setup('sqlite:///:memory:', '123'))
     self.bot.setup_db()
     self.webapp = webtest.TestApp(webserver.wsgi_app([self.bot]))
示例#11
0
    def setUp(self):
        from sample_plugin import TestPlugin
        from tgbot.webserver import wsgi_app

        self.bot = self.fake_bot("123", plugins=[TestPlugin()])
        self.webapp = TestApp(wsgi_app([self.bot]))
示例#12
0
 def setUp(self):
     self.bot = self.prepare_bot(pushitbot.PushItBot('botToken'))
     self.webapp = TestApp(
         pushitbot.extend_webapp(wsgi_app([self.bot]), self.bot))
 def setUp(self):
     self.bot = self.prepare_bot(
         bot=millionsbot.setup('sqlite:///:memory:', '123'))
     self.bot.setup_db()
     self.webapp = webtest.TestApp(webserver.wsgi_app([self.bot]))
     self.received_id = 1
示例#14
0
 def setUp(self):
     self.bot = self.prepare_bot(pushitbot.PushItBot('botToken'))
     self.webapp = TestApp(pushitbot.extend_webapp(wsgi_app([self.bot]), self.bot))