Skip to content

xelven/parse-accept-language

Repository files navigation

parse-accept-language

PyPI version

Parse Accept-Language HTTP header (https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14).

Installation

pip install parse-accept-language

How To Use

from accept_language import parse_accept_language

>>> parse_accept_language('es-mx;q=0.8,es,en')
[
    Lang(locale=None, language='es', quality=1.0),
    Lang(locale=None, language='en', quality=1.0),
    Lang(locale='es_MX', language='es', quality=0.8),
]

Specify a default quality value:

>>> parse_accept_language('en-US', default_quality=0.5)
[
    Lang(locale='en_US', language='en', quality=0.5),
]

About

Parse Accept-Language HTTP header

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages