Registry / devops / parse-accept-language

parse-accept-language

JSON →
library0.1.2pypypi✓ verified 79d ago

A tiny library to parse the Accept-Language HTTP header and return a list of language tags with quality values. Version 0.1.2 is the latest and only release; no changes since initial publication.

pip install parse-accept-language
INSTALL
IMPORT
SIG · PARSE-ACCEPT-LANGU
P
parse-accept-language
devopspythonv0.1.2
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

parse_accept_language
from accept_language import parse_accept_language
from parse_accept_language import parse_accept_language

Parses an Accept-Language header string into a list of language tags sorted by precedence.

from parse_accept_language import parse_accept_language header = 'en-US,en;q=0.9,fr;q=0.8' parsed = parse_accept_language(header) print(parsed) # ['en-US', 'en', 'fr']
Debug
Known issues
gotchaThe function returns a flat list of language tags, not a list of tuples with quality values.
fix
If you need quality values, parse the header manually with your own logic (e.g., split on commas and semicolons).
affects: 0.1.0 - 0.1.2
gotchaInput must be a string or a bytestring; passing None or other types raises a TypeError.
fix
Always ensure the argument is a string, e.g., `header or ''`.
affects: 0.1.0 - 0.1.2
Upgrade
Version history
0.1.2latest on PyPI · released Sep 4, 2017
Audit
Dependencies

No dependency data recorded yet.

Agent activity
2 hits · last 30 days
node
2
Resources

No resource links recorded.

parse-accept-language — pip install parse-accept-language · libregistry