Parse Accept-Language HTTP header (https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14).
pip install parse-accept-language
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),
]