Skip to main content

Fixed description, old version yanked.

Project description

httpackage: Python HTTP Server Module

Overview

httpackage is a Python module that provides a simple HTTP server implementation. It allows you to define routes and corresponding handler functions, making it easy to create basic web applications or APIs. The module is distributed under the Apache License 2.0, giving you the freedom to use, modify, and distribute the code.

License

httpackage is licensed under the Apache License 2.0. You can find a copy of the license in the LICENSE file.

Installation

httpackage does not require any special installation steps. Simply run pip install httpackage in your python terminal and start using it.

Usage

The module provides the server class, which you can use to create an HTTP server. Below is an example of how to use the server class:

from httpackage import server

# Create an instance of the server
app = server()

# Define routes using the `site` decorator
@app.site('/')
def home():
    return 'Hello, world!'

@app.site('/about')
def about():
    return 'This is the about page.'

# Run the server
if __name__ == '__main__':
    app.run(host='localhost', port=8080)

In the above example, we create a simple web application with two routes ('/' and '/about'). The home and about functions are the handlers for each route, which return the respective response.

API

class server

__init__(self)

Create an instance of the HTTP server.

site(self, path)

A decorator function used to define routes and their corresponding handler functions.

  • path: The URL path for the route.

serve(self, environ, start_response)

A method to handle incoming HTTP requests.

  • environ: The WSGI environment dictionary containing request details.
  • start_response: A callback function to begin the HTTP response.

run(self, host='localhost', port=8080)

Start the HTTP server and begin serving requests.

  • host: The hostname or IP address on which the server will listen.
  • port: The port number on which the server will listen.

Support

For any questions or concerns, please contact support@example.com.

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

httpackage-1.0.1.tar.gz (3.4 kB view details)

Uploaded Source

Built Distribution

httpackage-1.0.1-py3-none-any.whl (4.0 kB view details)

Uploaded Python 3

File details

Details for the file httpackage-1.0.1.tar.gz.

File metadata

  • Download URL: httpackage-1.0.1.tar.gz
  • Upload date:
  • Size: 3.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for httpackage-1.0.1.tar.gz
Algorithm Hash digest
SHA256 0d66e678b1aa9f567b65ab084ec047629e6b29106235677288e1f7519e99eeaf
MD5 10c066909f7fd2a2e1adb6b60725a1ac
BLAKE2b-256 9b3d400266aa17f63348a34d24bd399473f31425fad6f64d9fb5efe744b4ea0f

See more details on using hashes here.

File details

Details for the file httpackage-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: httpackage-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 4.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for httpackage-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 fa74c04ef870b59c5d66bbd229a07674e622cde92d7cb14464dd10b3071675fe
MD5 4c3f7f5b3005bb4a512628752aec5ddc
BLAKE2b-256 bbfbf832b033df1dd601b16c70cfd138f7a002afeca070a9874f2f8ef26bde0c

See more details on using hashes here.

Supported by

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