Skip to main content

Simple middleware for django to extract string queries from urls

Project description

QueryStringer

Simple middleware for django to extract string queries from urls

Installation

pip install querystringer

Import

import it inside middleware in django settings

middlewares = [
  ...,
  'querystringer.middleware.QueryStringer',
  ...,
]

Usage

all requests will have an edited request dict and you can access them by request.GET['queries']

Example

our view

def home(request):
    return HttpResponse(request.GET['queries'])

then send request to /home?test=true now we should except output like this

('test', 'true')

Remove specific characters

in your settings.py add a list with QUERY_REMOVE_STRINGS name to ignore characters you want like this

QUERY_REMOVE_STRINGS = ['-', '>', '%']

then the data you get will be clean like this request to /home?test=tru>e then we get (test, true)

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

querystringer-0.0.2-py3-none-any.whl (4.1 kB view details)

Uploaded Python 3

File details

Details for the file querystringer-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: querystringer-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 4.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/47.3.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.2

File hashes

Hashes for querystringer-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 833165795c2e9e2509cb7799bed099ac87a1bd20203b98dabd88f13a20d96580
MD5 372825eda6cfc766c3982038e3bba8bc
BLAKE2b-256 5c52e69affeaec9fdd11000d2d87052e71b4f4c58888f1ccd632892c4535dde3

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