1xch / flarf Goto Github PK
View Code? Open in Web Editor NEWflask request filter
License: MIT License
flask request filter
License: MIT License
Flarf: Flask Request Filter =========================== .. image:: https://secure.travis-ci.org/thrisp/flarf.png?branch=develop .. image:: https://pypip.in/v/Flask-Flarf/badge.png :target: https://pypi.python.org/pypi/Flask-Flarf/ :alt: Latest Version .. image:: https://pypip.in/d/Flask-Flarf/badge.png :target: https://pypi.python.org/pypi/Flask-Flarf/ :alt: Downloads .. image:: https://pypip.in/license/Flask-Flarf/badge.png :target: https://pypi.python.org/pypi/Flask-Flarf/ :alt: License Flarf allows you to filter flask request to your specification within your application, providing convenient access in your appplication and templates. Example for example purposes(see example app in examples directory): example.py: ------ from flask import Flask from flask.ext.flarf import Flarf, FlarFilter def format_from_request(request): return """ <h1>HEADER: {}</h1>\n header: {}\n <h1>METHOD: {}</h1>\n ARGS: {}\n """.format(request.headers.upper(), request.headers, request.method.lower(), request.args) flarf_filter = FlarfFilter(filter_tag='flarf_filter', filter_params=[format_from_request, 'my_val'], filter_on=['includeme']) app = Flask(__name__) Flarf(app, filters=[flarf_filter]) @app.route("/includeme") def index(): return render_template("index.html") index.html: ---------- MY_VAL: {{ flarf_filter.my_val | safe }} MY_REQUEST: {{ flarf_filter.format_from_request | safe }} Run the app and visit: http://127.0.0.1:5000/includeme?my_val="helloworld" Suggestions, input, & improvements welcomed.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.