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 package:
# RHTTP server
from rhttp_python import RHTTPServer
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:
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.9.tar.gz
(4.5 kB
view details)
File details
Details for the file rhttp_python-0.0.9.tar.gz.
File metadata
- Download URL: rhttp_python-0.0.9.tar.gz
- Upload date:
- Size: 4.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b3bfea4654b33a1ea7f15936bff587eaea633d08d4fe0358fdc218ee64c10e35
|
|
| MD5 |
85ee5ba6c5d8137f1d3e14f2d969fc4b
|
|
| BLAKE2b-256 |
de31c85922d87bb28b533862bdbd2e0fed3126bdae53646f85b813d5a20e4e90
|