hug-middleware-cors 1.0.0
pip install hug-middleware-cors
Latest version
Released:
CORS middleware for the hug framework
Navigation
Unverified details
These details have not been verified by PyPIProject links
Meta
- License: MIT License (MIT)
- Author: Stefan Seemayer
- Tags hug, cors, middleware, access-control-allow-origin
Classifiers
- Development Status
- Intended Audience
- License
- Programming Language
- Topic
Project description
# hug CORS middleware
A [hug](https://github.com/timothycrosley/hug) middleware for allowing CORS (cross-origin resource sharing) requests from hug servers.
## Installation
```bash
pip install hug_middleware_cors
```
## Usage
```python
import hug
from hug_middleware_cors import CORSMiddleware
api = hug.API(__name__)
api.http.add_middleware(CORSMiddleware(api))
@hug.post('/demo')
def demo(name: 'your name'):
return {"result": "Hello {0}".format(name)}
```
## Demoing
1. Check out this repository and navigate to its root
2. Start a hug server on port 8000 using: `hug -f server.py`
3. Start a static http server on port 8080 using `python -m http.server 8080`
4. Go to [http://localhost:8080](http://localhost:8080) to send a preflighted CORS request to the hug server.
## License
MIT License
See LICENSE for details
A [hug](https://github.com/timothycrosley/hug) middleware for allowing CORS (cross-origin resource sharing) requests from hug servers.
## Installation
```bash
pip install hug_middleware_cors
```
## Usage
```python
import hug
from hug_middleware_cors import CORSMiddleware
api = hug.API(__name__)
api.http.add_middleware(CORSMiddleware(api))
@hug.post('/demo')
def demo(name: 'your name'):
return {"result": "Hello {0}".format(name)}
```
## Demoing
1. Check out this repository and navigate to its root
2. Start a hug server on port 8000 using: `hug -f server.py`
3. Start a static http server on port 8080 using `python -m http.server 8080`
4. Go to [http://localhost:8080](http://localhost:8080) to send a preflighted CORS request to the hug server.
## License
MIT License
See LICENSE for details
Project details
Unverified details
These details have not been verified by PyPIProject links
Meta
- License: MIT License (MIT)
- Author: Stefan Seemayer
- Tags hug, cors, middleware, access-control-allow-origin
Classifiers
- Development Status
- Intended Audience
- License
- Programming Language
- Topic
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
Built Distribution
File details
Details for the file hug_middleware_cors-1.0.0.tar.gz
.
File metadata
- Download URL: hug_middleware_cors-1.0.0.tar.gz
- Upload date:
- Size: 2.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 96222e06db1a2748ec0ef0f51da2165faf59c69f40593a639c3f72e0b2375a58 |
|
MD5 | 8fcc6611d700a7589439c94ed2c9e030 |
|
BLAKE2b-256 | 6f27eb58db0af6121b1a6f2ec04e7a98a33801fd79613bf540a2c808ba90761d |
File details
Details for the file hug_middleware_cors-1.0.0-py3-none-any.whl
.
File metadata
- Download URL: hug_middleware_cors-1.0.0-py3-none-any.whl
- Upload date:
- Size: 4.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 33fbc3cf5bf9cd9f62268e6cf4eac7d9ceb0385dc0669faa5113a6edffb6cd1a |
|
MD5 | 2bc1ac504478ebe81a804188e883f56c |
|
BLAKE2b-256 | c4e246fbe122a5ca7f0dece1b46f7ce1a66cd6b01d9bdcda457600f32778dca7 |