Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

flask-request

Flask extension for applications needing to handle responses within an application and doubles as a mixin for client libraries.

Installation

Fill in later

Example

To use this as a flask extension do the following:

from flask import Flask, current_app

app = Flask(__name__)
app.session = RequestsSession(app)

@app.route('/')
def hello_world():
    response = current_app.session.http_fetch('https://some.site.io/api')
    if not response.ok:
        abort(response.status_code)
    decoded_response = response.json()
    # Do stuff with json and render response
    data = {'Hello': 'World', 'other': decoded_response['key']}
    return data, 200

Contributing

Set up your environment and run tests:

$ virtualenv --python=python3.7 env
(env) $ pip install requires/testing.txt
(env) $ nosetests -xvs tests

About

Extension for Flask Microservices to Handle Responses within an Application

Resources

Stars

Watchers

Forks

Releases

Packages

Used by

Contributors

Languages