RHTTP python interface
Project description
RHTTP-python
Python interface for RHTTP server
Installation
Install the latest version of rhttp-python with running installation command:
pip install rhttp-python
Usage
First you need to import required packages:
# RHTTP server
from rhttp_python import RHTTPServer
# Asyncio library for running server
import asyncio
First you need to create server by passing redis host and port:
server = RHTTPServer("127.0.0.1", 6379)
Then you can define endpoints using route decorator
@server.route("/", "GET")
def home(req, res):
print(req)
return res.status(200).content_type("text/html").send("<h1>test</h1>")
First parameter of decorator is "path" of endpoint and second is http method
At the end you need run server:
asyncio.run(server.listen())
License
This project is licensed under the terms of the MIT License. See the LICENSE file for details.
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
rhttp_python-0.0.3.tar.gz
(5.0 kB
view details)
File details
Details for the file rhttp_python-0.0.3.tar.gz.
File metadata
- Download URL: rhttp_python-0.0.3.tar.gz
- Upload date:
- Size: 5.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
be888295634fe8d36c9b0da2a49a66346a0666cdb3526921047ab239bb6fff66
|
|
| MD5 |
3176a64399d1abacb00bc7d707250eb9
|
|
| BLAKE2b-256 |
eab70d8e3d3e50e3e367455fd0b4200b60977ecc9cd4cfc353ae2033f7d5603c
|