diff weather_server/server.py @ 4:e7c8dcc5fc15

Make the weather server pip-installable and locally runnable.
author Paul Fisher <paul@pfish.zone>
date Sun, 29 Sep 2019 15:10:18 -0400
parents b42c4bfe57c7
children 368f732f13d0
line wrap: on
line diff
--- a/weather_server/server.py	Sun Sep 29 11:52:48 2019 -0400
+++ b/weather_server/server.py	Sun Sep 29 15:10:18 2019 -0400
@@ -1,6 +1,7 @@
+import hmac
+
 import bson
 import flask
-import hmac
 
 from . import common
 from . import locations
@@ -65,3 +66,13 @@
             date=date)
 
     return app
+
+
+def main(argv):
+    """Main function for a simple local demo."""
+    app = server.build_app(argv[0])
+    app.run(host='0.0.0.0')
+
+
+if __name__ == '__main__':
+    main(sys.argv[1:])