HTTP Content Security Policy Manager
Project description
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;
.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
http_csp-0.1.2.tar.gz
(2.5 kB
view details)
Built Distribution
File details
Details for the file http_csp-0.1.2.tar.gz
.
File metadata
- Download URL: http_csp-0.1.2.tar.gz
- Upload date:
- Size: 2.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.6.1 CPython/3.11.5 Darwin/23.0.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4fafb1ea28f923e440d89abd558b656f41ee260416e6ede22e86b557af734149 |
|
MD5 | 12ac714f40abb1243fdeab459ea99977 |
|
BLAKE2b-256 | 3924c8e5eeda4f927afb33c122a281a3d95bc4d9c77a5c4d92d7208e632f03ca |
File details
Details for the file http_csp-0.1.2-py3-none-any.whl
.
File metadata
- Download URL: http_csp-0.1.2-py3-none-any.whl
- Upload date:
- Size: 3.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.6.1 CPython/3.11.5 Darwin/23.0.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f41ee2114864b703d2c3210583ed83ca745e2cdbcdff9d4eb44678ab9e79f57a |
|
MD5 | 73438ec568f1ce540489f9d2c6e08539 |
|
BLAKE2b-256 | 026ab751aaf45f4a5c3973c624c7eb637de14b54375f26ab25383dfa6f21621c |