Skip to content

Instantly share code, notes, and snippets.

@RobSpectre
Created May 6, 2015 01:12
Show Gist options
  • Save RobSpectre/6f1c1d46c2066ffbd34b to your computer and use it in GitHub Desktop.
Save RobSpectre/6f1c1d46c2066ffbd34b to your computer and use it in GitHub Desktop.
Solution to $ bash Coding Challenge 6
import requests
import timeit
def return_42_after_75_seconds():
try:
requests.get('http://localhost:5000/', timeout=75)
except:
pass
return 42
if __name__ == "__main__":
print timeit.timeit("""print return_42_after_75_seconds()""", number=1,
setup="""from __main__ import return_42_after_75_seconds""")
from flask import Flask
app = Flask(__name__)
@app.route('/')
def index():
while True:
continue
return "Never gonna happen."
if __name__ == "__main__":
app.debug = True
app.run()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment