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

http-csp

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

http-csp

HTTP Content Security Policy Manager

  • 0.1.2
  • PyPI
  • Socket score

Maintainers
1

python-http-csp

HTTP Content Security Policy Manager

A library to make parsing and generating CSP policies a little easier.

Read more about Content Security Policies: https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP

Installing

Install this library from PyPI:

pip3 install http-csp

Using this library

Parsing a CSP string:

policy = CSP("default-src 'self';")

returns a CSP object with a default_src attribute with value ["'self'"].

Generating a CSP string:

policy = CSP()
policy.default_src = ["'self'"]
policy.image_src = ["*"]
policy.media_src = ["example.org", "example.net"]
generated_policy = policy.generate()

returns a string with the value default-src 'self'; img-src *; media-src example.org example.net;.

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