Flask-request-params
Flask-request-params provides Rails-like interface to HTTP Request Parameters for Flask.
Supports mixed parameters(GET, POST, POST-JSON), Rails Strong_Parameters.
Documents are here.
Installation
To install Flask-request-params, simply:
pip install flask-request-params
Or alternatively, you can download the repository and install manually by doing:
git clone git@github.com:bluele/flask-request-params.git cd flask-request-params python setup.py install
Examples
See examples for more code.
Client code
# support hash type
$ curl -X POST http://localhost:5000/echo/user -d 'user[name]=john&user[password]=pass'
{
"path": "user",
"user": {
"name": "john",
"password": "pass"
}
}
# support array type
$ curl -X POST http://localhost:5000/echo/lang -d 'languages[]=python&languages[]=golang'
{
"path": "lang",
"languages": [
"python",
"golang"
]
}
# support strong_parameters
$ curl -X POST http://localhost:5000/user -d 'user[name]=bluele&user[password]=password'
{
"name": "bluele",
"password": "password"
}
Server code
from flask import Flask, request, render_template, jsonify
from flask_request_params import bind_request_params
app = Flask(__name__)
app.secret_key = 'secret'
# bind rails like params to request.params
app.before_request(bind_request_params)
# just return request.params
@app.route('/echo/<path>', methods=['GET', 'POST'])
def echo(path):
return jsonify(request.params)
@app.route('/user', methods=['POST'])
def create_user():
user = request.params.require('user').permit('name', 'password')
# do something
return jsonify(user)
# serve at localhost:5000
app.run(debug=True)
Metadata
Release files for Flask-request-params 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| Flask-request-params-0.3.0.tar.gz | 4.2 kB | Without provenance | Details for Flask-request-params-0.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| Flask_request_params-0.3.0-py2-none-any.whl | Python 2 | none | any | Details for Flask_request_params-0.3.0-py2-none-any.whl |
Total release size: 11.1 kB
Release files / Flask-request-params-0.3.0.tar.gz
| Download URL | Flask-request-params-0.3.0.tar.gz |
|---|---|
| Size | 4.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0e15f8999049c8d1a2dcded9a6dbb7ffc731fedbdcb5ee1eba12af4800a2b905
|
|
BLAKE2b-256 checksum How to use checksums |
3314f41ab27df8d0c59ddfe5063a5bdfcb687174e7573eac62ded2f758b7447f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / Flask_request_params-0.3.0-py2-none-any.whl
| Download URL | Flask_request_params-0.3.0-py2-none-any.whl |
|---|---|
| Size | 7.0 kB |
| Tags | Python 2 |
|
SHA-256 checksum How to use checksums |
e4117b69cc7ab603e99491b3bca31471c1bba90d0f5a078c513ee00926de00b4
|
|
BLAKE2b-256 checksum How to use checksums |
f6ed5fe85e75dd20e880bc54b8119c7403cc2f7e5f95e09be2e6169b951ab88c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for Flask-request-params 0.3.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.