Commit 190eacee authored by Your Name's avatar Your Name

encapsulate?

parent 38978154
...@@ -21,6 +21,8 @@ TWITTER_AUTH_KEY = 'AAAAAAAAAAAAAAAAAAAAANRILgAAAAAAnNwIzUejRCOuH5E6I8xnZz4puTs% ...@@ -21,6 +21,8 @@ TWITTER_AUTH_KEY = 'AAAAAAAAAAAAAAAAAAAAANRILgAAAAAAnNwIzUejRCOuH5E6I8xnZz4puTs%
routes = web.RouteTableDef() routes = web.RouteTableDef()
app = web.Application()
class UnexpectedApiError(Exception): class UnexpectedApiError(Exception):
pass pass
...@@ -614,7 +616,6 @@ if (args.cors_allow is None): ...@@ -614,7 +616,6 @@ if (args.cors_allow is None):
else: else:
debug('[CORS] Allowing requests from: ' + args.cors_allow) debug('[CORS] Allowing requests from: ' + args.cors_allow)
accounts = [] accounts = []
if args.account_file is None: if args.account_file is None:
debug('No account file specified.') debug('No account file specified.')
...@@ -645,9 +646,7 @@ def run(): ...@@ -645,9 +646,7 @@ def run():
loop = asyncio.get_event_loop() loop = asyncio.get_event_loop()
loop.run_until_complete(login_accounts(accounts, args.cookie_dir)) loop.run_until_complete(login_accounts(accounts, args.cookie_dir))
loop.run_until_complete(login_guests()) loop.run_until_complete(login_guests())
app = web.Application()
app.add_routes(routes) app.add_routes(routes)
web.run_app(app, host=args.host, port=args.port)
return app return app
if args.daemon: if args.daemon:
...@@ -655,3 +654,6 @@ if args.daemon: ...@@ -655,3 +654,6 @@ if args.daemon:
run() run()
else: else:
run() run()
if __name__ == "__main__":
web.run_app(app, host=args.host, port=args.port)
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment