Created
May 6, 2015 01:12
-
-
Save RobSpectre/6f1c1d46c2066ffbd34b to your computer and use it in GitHub Desktop.
Solution to $ bash Coding Challenge 6
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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""") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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