Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

acceptlang

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

acceptlang

A package for parsing Accept-Language tag received from (untrusted) client context.

  • 0.0.5
  • Source
  • PyPI
  • Socket score

Maintainers
1

Simple package for parsing Accept-Language tag.

This package can be used in the server environment to parse the Accept-Language header.

Test cases and code copied from Django source code enhanced with typing.

Purpose of this code is to be able to use a battle-tested Accept-Language parsing logic in Python code without need to install Django package.

Installation

You can install the package via pip:

pip install acceptlang

Usage

from acceptlang import parse_accept_lang_header

result = parse_accept_lang_header("en-us,en;q=0.5,de;q=0.3")
assert result == (('en-us', 1.0), ('en',0.5), ('de',0.3))

result = parse_accept_lang_header("en-us,*;q=0.5")
assert result == (('en-us', 1.0), ('*',0.5))

Check tests for more examples.

Local development

python3 -m venv venv
. venv/bin/activate
python3 -m pip install -r requirements.dev.txt

Build and publish

python3 -m build --wheel
twine check dist/**
twine upload dist/

FAQs


Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc