Created
August 22, 2017 21:26
-
-
Save cburmeister/e44c08c97a084ad0721146aeec3ccfd9 to your computer and use it in GitHub Desktop.
An example of how to dogfood a Flask API.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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