Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cinaaaa/querystringer
Simple middleware for django to extract string queries from urls
https://github.com/cinaaaa/querystringer
django djangomiddle middleware query querystringer string stringquery
Last synced: 15 days ago
JSON representation
Simple middleware for django to extract string queries from urls
- Host: GitHub
- URL: https://github.com/cinaaaa/querystringer
- Owner: cinaaaa
- License: mit
- Created: 2020-06-17T10:38:23.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-06-25T13:09:00.000Z (over 4 years ago)
- Last Synced: 2025-01-03T05:35:03.683Z (19 days ago)
- Topics: django, djangomiddle, middleware, query, querystringer, string, stringquery
- Language: Python
- Homepage: https://pypi.org/project/querystringer/
- Size: 10.7 KB
- Stars: 3
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Query Stringer
Simple middleware for django to extract string queries from urls
# Whats Query Stringer
query stringer is simple middleware for django > * to get string querys from urls and do some filters on them too# 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)`