Merge pull request #253 from s-chizhik/feature

Add ability to specify port/host to run on
This commit is contained in:
Ian Cordasco
2016-03-20 13:51:31 -05:00
2 changed files with 7 additions and 2 deletions
+1 -1
View File
@@ -194,7 +194,7 @@ Or run it directly:
.. code:: bash
$ python -m httpbin.core
$ python -m httpbin.core [--port=PORT] [--host=HOST]
Changelog
---------
+6 -1
View File
@@ -13,6 +13,7 @@ import os
import random
import time
import uuid
import argparse
from flask import Flask, Response, request, render_template, redirect, jsonify as flask_jsonify, make_response, url_for
from werkzeug.datastructures import WWWAuthenticate, MultiDict
@@ -709,4 +710,8 @@ def xml():
if __name__ == '__main__':
app.run()
parser = argparse.ArgumentParser()
parser.add_argument("--port", type=int, default=5000)
parser.add_argument("--host", default="127.0.0.1")
args = parser.parse_args()
app.run(port=args.port, host=args.host)