Re:Httpstat.us: API for generating different HTTP codes.
by jsdalton on Tuesday February 15, 2011 @12:28PM
(#2222184)
Here's a little something similar I whipped up using Flask (Python):
import time
from flask import Flask, make_response, request
app = Flask(__name__)
@app.route('/<int:status_code>')
def return_status(status_code):
response = make_response()
response.status_code = status_code
response.data = response.status
sleep = request.args.get('sleep', None)
if sleep is not None:
time.sleep(int(sleep))
return response
if __name__ == '__main__':
app.run(debug=True)
With a handy little feature, a "sleep" query string param that'll delay the response for the given number of seconds, which I've used to test how a client handles latency etc.
[BTW, looks like you're the Elliot Carlson I used to work with way back when. Hope life is treating you well these days! :)]
[BTW, looks like you're the Elliot Carlson I used to work with way back when. Hope life is treating you well these days! :)]