apistar_cors_hooks
This project enables CORS on API Star apps via event hooks.
Suppports:
apistar>=0.4.0
python>=3.6
Installation
Install via PyPI:
pip install apistar_cors_hooks
After installing, we need to add and instance of CORSRequestHooks to your event_hooks in your app:
from apistar import App, Route
from apistar_cors_hooks import CORSRequestHooks
def homepage() -> str:
return '<html><body><h1>Homepage</h1></body></html>'
routes = [
Route('/', method='GET', handler=homepage),
]
event_hooks = [CORSRequestHooks()]
app = App(routes=routes, event_hooks=event_hooks)
If you want to customize WSGICORS options, you just need to pass a dict via the options kwarg:
custom_options = {"origin": "your_host_server"}
event_hooks = [CORSRequestHooks(options=custom_options)]
app = App(routes=routes, event_hooks=event_hooks)
Contributing
Since I’m a WSGI/CORS noob, I may have left a bug or two, or didn’t think of better ways to implement this.
Be free to open an issue, contribute with PRs and contact me at luciano@ratamero.com.
Changelog
0.1.1
adds README.rst as long description on PyPI
0.1.0
initial version
Metadata
Release files for apistar-cors-hooks 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| apistar_cors_hooks-0.1.1.tar.gz | 2.6 kB | Without provenance | Details for apistar_cors_hooks-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| apistar_cors_hooks-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for apistar_cors_hooks-0.1.1-py3-none-any.whl |
Total release size: 6.2 kB
Release files / apistar_cors_hooks-0.1.1.tar.gz
| Download URL | apistar_cors_hooks-0.1.1.tar.gz |
|---|---|
| Size | 2.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7e4cb7d62ed0348993cce9845df08ba39538269ebf5d9e2dc2c551fd20946d6d
|
|
BLAKE2b-256 checksum How to use checksums |
07e22ed80657b26ceea89e7215e855df799d30890ecf1ecf18ea5684880d4861
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / apistar_cors_hooks-0.1.1-py3-none-any.whl
| Download URL | apistar_cors_hooks-0.1.1-py3-none-any.whl |
|---|---|
| Size | 3.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f675de38bc550b3238b8a5ece39b2caf32a29292eb10bd67d562a7dc847c8cbd
|
|
BLAKE2b-256 checksum How to use checksums |
3c998c89672b2338c04f685545f95712a304f54c7986d387ab676e8c72f04ac8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for apistar-cors-hooks 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.