Skip to main content

flask-httpretty help you to mock http requests via flask.

Project description

https://travis-ci.org/admire93/flask-httpretty.svg?branch=master

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

Project details


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 hashes)

Uploaded Source

Built Distribution

Flask_httpretty-1.3.0-py2.py3-none-any.whl (7.2 kB view hashes)

Uploaded Python 2 Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page