Skip to main content

Better HTTP parameters.

Project description

Paramo

Paramo is a library for HTTP parameter (Query) parsing.
It acts much like a common CLI argument parser, letting you adding default values.

Installation

# Git + Pip
pip install git+https://github.com/ZSendokame/Paramo

# Pip
pip install Paramo

Use

import paramo
from flask import Flask, request

app = Flask(__name__)
params = paramo.Parser()


@app.before_request
def before():
    params.add('name', default='Drackord')
    params.add('role', default='The lost son of Julio Iglesias')
    params.parse(request.url)


@app.get('/')
def root():
    params.query_list['unparsed'] = paramo.unparse(params.query_list)

    return params.query_list


app.run()

# url: http://127.0.0.1:5000/?surname=Iglesias
# {
#   "name": "Drackord",
#   "role": "The lost son of Julio Iglesias",
#   "surname": "Iglesias",
#   "unparsed": "?surname=Iglesias&name=Drackord&role=The lost son of Julio Iglesias"
# }

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

Paramo-1.0.0.tar.gz (2.2 kB view details)

Uploaded Source

File details

Details for the file Paramo-1.0.0.tar.gz.

File metadata

  • Download URL: Paramo-1.0.0.tar.gz
  • Upload date:
  • Size: 2.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.5

File hashes

Hashes for Paramo-1.0.0.tar.gz
Algorithm Hash digest
SHA256 53f36e6b845408fb683a60482c3ba3d3461037322dfda34430d7cfcdc612ee07
MD5 b06833440033c7ee91aad2b9b82ac7ab
BLAKE2b-256 6d68ff28d809a9327c03bf8fc14670f4f04bba040a722dcc1aeb540ea6034be6

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page