Skip to main content

Lightweight HTTP server framework

Project description

PyDobby

Lightweight HTTP server framework built on Python's socket programming using TCP.

Features

  • Routing with path parameters support
  • Query parameter parsing
  • Middleware system for request/response processing
  • Custom headers support

Installation

pip install pydobby

Usage

from pydobby import PyDobby, HTTPRequest, HTTPResponse
import json
import logging

app = PyDobby()

# Custom middleware example
class LoggingMiddleware:
    def __init__(self, get_response):
        self.get_response = get_response

    def __call__(self, request):
        logging.info(f"Request: {request.method} {request.path}")
        response = self.get_response(request)
        logging.info(f"Response: {response.status_code}")
        return response

app.register_middleware(LoggingMiddleware)

# Basic route with path parameter
@app.get("/hello/<name>")
def hello(request: HTTPRequest, name: str) -> HTTPResponse:
    return HTTPResponse(body=f"Hello, {name}!")



# JSON handling example
@app.post("/submit")
def submit(request: HTTPRequest) -> HTTPResponse:
    data = json.loads(request.body)
    return HTTPResponse(status_code=201)

# Run the server
if __name__ == "__main__":
    app.start()

Development

  1. Clone the repository:
git clone https://github.com/yourusername/pydobby.git
cd pydobby
  1. Install in development mode:
pip install -e .
  1. Run the example:
python examples/basic_app.py

TODO

Improvements and features:

  • Static File Serving
  • CORS Support
  • Cookie Handling
  • Session Management
  • File Upload
  • SSL Support

License

MIT License

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

pydobby-0.1.2.tar.gz (5.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pydobby-0.1.2-py3-none-any.whl (7.0 kB view details)

Uploaded Python 3

File details

Details for the file pydobby-0.1.2.tar.gz.

File metadata

  • Download URL: pydobby-0.1.2.tar.gz
  • Upload date:
  • Size: 5.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for pydobby-0.1.2.tar.gz
Algorithm Hash digest
SHA256 da2cbab127666e4aaa1bb9dde7c76c85966d2f85f0d1e79f61a0e6a22c256088
MD5 d146c3c97c13770ddbb7dda5239dc1c5
BLAKE2b-256 503b2611c272def952fbe91e3b27e393309c366b20b20cf29a0ca21272889333

See more details on using hashes here.

Provenance

The following attestation bundles were made for pydobby-0.1.2.tar.gz:

Publisher: pipeline.yml on 0xZaki/pydobby

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pydobby-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: pydobby-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 7.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for pydobby-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 c893f51fbd826cd1a66b60435c98a1416bbeee2d95a04303bef1483ac01254ea
MD5 a08af5bf7dd57167137c56cca704ae86
BLAKE2b-256 4dcef994d00568969f792fe218715c3dfdda8b4179db4aa2c8230fab850c48c7

See more details on using hashes here.

Provenance

The following attestation bundles were made for pydobby-0.1.2-py3-none-any.whl:

Publisher: pipeline.yml on 0xZaki/pydobby

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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