Skip to content

Instantly share code, notes, and snippets.

@cburmeister
Created August 22, 2017 21:26
Show Gist options
  • Save cburmeister/e44c08c97a084ad0721146aeec3ccfd9 to your computer and use it in GitHub Desktop.
Save cburmeister/e44c08c97a084ad0721146aeec3ccfd9 to your computer and use it in GitHub Desktop.
An example of how to dogfood a Flask API.
from flask import Flask, url_for
from werkzeug.test import Client
from werkzeug.wrappers import Response
app = Flask(__name__)
@app.route('/bar')
def bar():
return 'Hello World!'
@app.route('/foo')
def foo():
api_client = Client(app, Response)
response = api_client.get(url_for('bar'))
return response.data
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment