$ docker run -p 80:80 kennethreitz/httpbin",
+ "description": (
+ "A simple HTTP Request & Response Service."
+ "$ docker run -p 80:80 kennethreitz/httpbin"
+ ),
"contact": {
"responsibleOrganization": "Kenneth Reitz",
"responsibleDeveloper": "Kenneth Reitz",
@@ -75,11 +80,29 @@ template = {
# "termsOfService": "http://me.com/terms",
"version": "0.9.0"
},
- "host": "httpbin.org", # overrides localhost:500
+ "host": "httpbin.org", # overrides localhost:5000
"basePath": "/", # base bash for blueprint registration
"schemes": [
- "http",
- "https"
+ "https",
+ "http"
+ ],
+ 'protocol': 'https',
+ 'tags': [
+ {
+ 'name': 'HTTP Methods',
+ 'description': 'Testing different HTTP verbs',
+ # 'externalDocs': {'description': 'Learn more', 'url': 'https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html'}
+ },
+ {'name': 'Auth', 'description': 'Auth methods'},
+ {'name': 'Status codes', 'description': 'Generates responses with given status code'},
+ {'name': 'Request inspection', 'description': 'Inspect the request data'},
+ {'name': 'Response inspection', 'description': 'Inspect the response data like caching and headers'},
+ {'name': 'Response formats', 'description': 'Returns responses in different data formats'},
+ {'name': 'Dynamic data', 'description': 'Generates random and dynamic data'},
+ {'name': 'Cookies', 'description': 'Creates, reads and deletes Cookies'},
+ {'name': 'Images', 'description': 'Returns different image formats'},
+ {'name': 'Redirects', 'description': 'Returns different redirect responses'},
+ {'name': 'Anything', 'description': 'Returns anything that is passed to request'},
]
}
@@ -165,17 +188,18 @@ def set_cors_headers(response):
# Routes
# ------
-# @app.route('/')
-# def view_landing_page():
-# """Generates Landing Page."""
-# tracking_enabled = 'HTTPBIN_TRACKING' in os.environ
-# return render_template('index.html', tracking_enabled=tracking_enabled)
+@app.route('/legacy')
+def view_landing_page():
+ """Generates Landing Page in legacy layout."""
+ return render_template('index.html')
@app.route('/html')
def view_html_page():
"""Returns a simple HTML document.
---
+ tags:
+ - Response formats
responses:
200:
description: An HTML page.
@@ -186,7 +210,14 @@ def view_html_page():
@app.route('/robots.txt')
def view_robots_page():
- """Returns a simple HTML document."""
+ """Returns some robots.txt rules.
+ ---
+ tags:
+ - Response formats
+ responses:
+ 200:
+ description: Robots file
+ """
response = make_response()
response.data = ROBOT_TXT
@@ -196,7 +227,14 @@ def view_robots_page():
@app.route('/deny')
def view_deny_page():
- """Simple Html Page"""
+ """Returns page denied by robots.txt rules.
+ ---
+ tags:
+ - Response formats
+ responses:
+ 200:
+ description: Denied message
+ """
response = make_response()
response.data = ANGRY_ASCII
response.content_type = "text/plain"
@@ -208,6 +246,8 @@ def view_deny_page():
def view_origin():
"""Returns the requester's IP Address.
---
+ tags:
+ - Request inspection
responses:
200:
description: The Requester's IP Address.
@@ -220,6 +260,8 @@ def view_origin():
def view_uuid():
"""Return a UUID4.
---
+ tags:
+ - Dynamic data
responses:
200:
description: A UUID4.
@@ -232,6 +274,8 @@ def view_uuid():
def view_headers():
"""Return the incoming requests's HTTP headers.
---
+ tags:
+ - Request inspection
responses:
200:
description: The Rrquest's IP Address.
@@ -244,6 +288,8 @@ def view_headers():
def view_user_agent():
"""Return the incoming requests's User-Agent header.
---
+ tags:
+ - Request inspection
responses:
200:
description: The request's User-Agent header..
@@ -258,6 +304,8 @@ def view_user_agent():
def view_get():
"""The request's query parameters.
---
+ tags:
+ - HTTP Methods
responses:
200:
description: The request's query parameters.
@@ -269,7 +317,14 @@ def view_get():
@app.route('/anything', methods=['GET', 'POST', 'PUT', 'DELETE', 'PATCH', 'TRACE'])
@app.route('/anything/
+
+
+
+
+
+Freely hosted in HTTP, HTTPS, & EU flavors by Kenneth Reitz & Heroku.
+ +You can install httpbin as a library from PyPI and run it as a WSGI app. For example, using Gunicorn:
+ +$ pip install httpbin
+$ gunicorn httpbin:app
+
+
+$ docker run -p 80:80 kennethreitz/httpbin
+
+
+A Kenneth Reitz project.
+BTC: 1Me2iXTJ91FYZhrGvaGaRDCBtnZ4KdxCug
Hurl.it - Make HTTP requests.
+RequestBin - Inspect HTTP requests.
+ + + +