
Security News
Opengrep Adds Apex Support and New Rule Controls in Latest Updates
The latest Opengrep releases add Apex scanning, precision rule tuning, and performance gains for open source static code analysis.
django-accept-header
Advanced tools
A Django middleware that inspects the HTTP Accept headers sent by browsers.
.. list-table:: :stub-columns: 1
* - docs
- |docs|
* - tests
- | |travis| |requires|
| |codecov|
|
* - package
- |version| |downloads| |wheel| |supported-versions| |supported-implementations|
.. |docs| image:: https://readthedocs.org/projects/django-accept-header/badge/?style=flat :target: https://readthedocs.org/projects/django-accept-header :alt: Documentation Status
.. |travis| image:: https://travis-ci.org/fladi/django-accept-header.svg?branch=master :alt: Travis-CI Build Status :target: https://travis-ci.org/fladi/django-accept-header
.. |requires| image:: https://requires.io/github/fladi/django-accept-header/requirements.svg?branch=master :alt: Requirements Status :target: https://requires.io/github/fladi/django-accept-header/requirements/?branch=master
.. |codecov| image:: https://codecov.io/github/fladi/django-accept-header/coverage.svg?branch=master :alt: Coverage Status :target: https://codecov.io/github/fladi/django-accept-header
.. |version| image:: https://img.shields.io/pypi/v/django-accept-header.svg?style=flat :alt: PyPI Package latest release :target: https://pypi.python.org/pypi/django-accept-header
.. |downloads| image:: https://img.shields.io/pypi/dm/django-accept-header.svg?style=flat :alt: PyPI Package monthly downloads :target: https://pypi.python.org/pypi/django-accept-header
.. |wheel| image:: https://img.shields.io/pypi/wheel/django-accept-header.svg?style=flat :alt: PyPI Wheel :target: https://pypi.python.org/pypi/django-accept-header
.. |supported-versions| image:: https://img.shields.io/pypi/pyversions/django-accept-header.svg?style=flat :alt: Supported versions :target: https://pypi.python.org/pypi/django-accept-header
.. |supported-implementations| image:: https://img.shields.io/pypi/implementation/django-accept-header.svg?style=flat :alt: Supported implementations :target: https://pypi.python.org/pypi/django-accept-header
A Django middleware that inspects the HTTP Acept headers sent by browsers. It adds a new method to each request
instance called accepts(str)
which can be used
to determine if a certain mimetype is accepted by the user agent that issued the request.
::
pip install django-accept-header
First add the middleware to your settings.py
file::
MIDDLEWARE_CLASSES = (
# ...
'django_accept_header.middleware.AcceptMiddleware',
)
To check if the text/plain
mimetype is accepted by the user agent::
def some_view(request):
if request.accepts('text/plain'):
# do something
The ordered list of accepted mimetypes can also be used::
def some_view(request):
for media_type in request.accepted_types:
# do something
See the full documentation for how to use the media types please see the full documentation.
https://django-accept-header.readthedocs.org/
To run the all tests run::
tox
FAQs
A Django middleware that inspects the HTTP Accept headers sent by browsers.
We found that django-accept-header demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The latest Opengrep releases add Apex scanning, precision rule tuning, and performance gains for open source static code analysis.
Security News
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
Research
/Security News
A RubyGems malware campaign used 60 malicious packages posing as automation tools to steal credentials from social media and marketing tool users.