Mock http request with flask!
flask-httpretty is built based on httpretty.
Hello world
from flask import Flask
from urllib.request import urlopen
import flask_httpretty
app = Flask(__name__)
@app.route('/', methods=['GET'])
def hello_world():
return 'hello world'
@flask_httpretty.activate
def test_hello_world():
flask_httpretty.register_app(app, 'http://hellotest.com')
resp = urlopen('http://hellotest.com').read()
assert 'hello world' == resp.decode('utf-8')
Officially supported libraries
Since flask-httpretty use httpretty to monkey patches pythons’socket, it support same libraries httpretty do. these are
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Flask-httpretty-1.3.0.tar.gz
(4.4 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file Flask-httpretty-1.3.0.tar.gz.
File metadata
- Download URL: Flask-httpretty-1.3.0.tar.gz
- Upload date:
- Size: 4.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b5192a638aeacf07d0ef6b91a0ba4ee66146b4f5c4037bd8a07fa3fae0b13edb
|
|
| MD5 |
79107308743f2102feafa4da0fc5e3b7
|
|
| BLAKE2b-256 |
f3de2ec2ea4fff084483afa3597cae7fdd8eb201efbb4ac3dd5bff4aeff591db
|
File details
Details for the file Flask_httpretty-1.3.0-py2.py3-none-any.whl.
File metadata
- Download URL: Flask_httpretty-1.3.0-py2.py3-none-any.whl
- Upload date:
- Size: 7.2 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5a5a3abe3c14390cfb9a7858381090b483b473b3d156b971aab6677816e7a533
|
|
| MD5 |
50bd2a054d15c6e849a7ff2e5e31dd9d
|
|
| BLAKE2b-256 |
913d101d2c3ea72163f69084a8a763438d0080c84afa7f9eff181e8a3cad027d
|