Running the Tornado Facebook example
-=====================================
-To work with the provided Facebook api key, this example must be
-accessed at http://localhost:8888/ to match the Connect URL set in the
-example application.
+====================================
-To use any other domain, a new Facebook application must be registered
-with a Connect URL set to that domain.
+To run this example, you must register a Facebook application with a
+Connect URL set to the domain the this demo will be running on
+(i.e. http://localhost:8888/ by default). The API key and secret
+for this application must be passed on the command line:
+
+ python facebook.py --facebook_api_key=ABC --facebook_secret=XYZ
from tornado.options import define, options
define("port", default=8888, help="run on the given port", type=int)
-define("facebook_api_key", help="your Facebook application API key",
- default="9e2ada1b462142c4dfcc8e894ea1e37c")
-define("facebook_secret", help="your Facebook application secret",
- default="32fc6114554e3c53d5952594510021e2")
+define("facebook_api_key", help="your Facebook application API key", type=str)
+define("facebook_secret", help="your Facebook application secret", type=str)
class Application(tornado.web.Application):
def main():
tornado.options.parse_command_line()
+ if not (options.facebook_api_key and options.facebook_secret):
+ print("--facebook_api_key and --facebook_secret must be set")
+ return
http_server = tornado.httpserver.HTTPServer(Application())
http_server.listen(options.port)
tornado.ioloop.IOLoop.instance().start()