Skip to main content

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


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.1.0.tar.gz (5.0 kB view details)

Uploaded Source

File details

Details for the file rhttp_python-0.1.0.tar.gz.

File metadata

  • Download URL: rhttp_python-0.1.0.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

Hashes for rhttp_python-0.1.0.tar.gz
Algorithm Hash digest
SHA256 8c86a0f3ff2d3aec3c1435e142ca3fb3ae335594d242edf6ece0182664ad1a6a
MD5 510c9f8622c1df06dbe5ed872bb747e7
BLAKE2b-256 4c660504c81fba809b02c2f9b955c575706f6c87aa8f8072db0bc6547d393be9

See more details on using hashes here.

Supported by

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