mirror of
https://github.com/kennethreitz/httpbin.git
synced 2026-06-05 23:00:18 +00:00
30 lines
511 B
Python
Executable File
30 lines
511 B
Python
Executable File
# -*- coding: utf-8 -*-
|
|
|
|
"""
|
|
httpbin.runner
|
|
~~~~~~~~~~~~~~
|
|
|
|
This module serves as a command-line runner for httpbin, powered by
|
|
gunicorn.
|
|
|
|
"""
|
|
|
|
import sys
|
|
|
|
from gevent.pywsgi import WSGIServer
|
|
from httpbin import app
|
|
|
|
|
|
def main():
|
|
try:
|
|
port = int(sys.argv[1])
|
|
except (KeyError, ValueError, IndexError):
|
|
port = 5000
|
|
|
|
print 'Starting httpbin on port {0}'.format(port)
|
|
http_server = WSGIServer(('', port), app)
|
|
http_server.serve_forever()
|
|
|
|
if __name__ == '__main__':
|
|
main()
|