Skip to main content

CORS Policy for Web applications

Project description

This package allows you to create a policy that can handle CORS. It can be used with any python framework as it’s totally agnostic. It can cook response headers, even for preflight requests.

Example

from roughrider.cors.policy import CORSPolicy

cors = CORSPolicy(
    methods=['GET', 'POST'],
    allow_headers=['Accept-Encoding'],
    expose_headers=['Accept-Encoding'],
    max_age=19000
)

headers = list(cors.headers())

# Arguments for the preflight should be extracted from the request.
# depending on the type of framework you use (WSGI, ASGI...)
preflight_headers = list(cors.preflight(
    origin='http://example.com',
    acr_headers='X-Custom-Header, Accept-Encoding'
))

CHANGES

0.1 (2021-10-09)

  • Initial release.

Project details


Release history Release notifications | RSS feed

This version

0.1

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

roughrider.cors-0.1.tar.gz (5.9 kB view details)

Uploaded Source

File details

Details for the file roughrider.cors-0.1.tar.gz.

File metadata

  • Download URL: roughrider.cors-0.1.tar.gz
  • Upload date:
  • Size: 5.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Python-urllib/3.8

File hashes

Hashes for roughrider.cors-0.1.tar.gz
Algorithm Hash digest
SHA256 c65717ba70830008551f4b9f0910025cef01b5d378c15e7eae408f5e80e36eaf
MD5 040e1e902e04044c2ad83e965b1655e8
BLAKE2b-256 bdd513ad173e5cbdc5c31a182f45cd0de95a7d8d235cf344cd407772d7ab49e8

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page