mirror of
https://github.com/kennethreitz/httpbin.git
synced 2026-06-05 23:00:18 +00:00
Merge pull request #253 from s-chizhik/feature
Add ability to specify port/host to run on
This commit is contained in:
+1
-1
@@ -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
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user