Skip to main content

HTTP and HTTPS server framework

Project description

Slinn is a HTTP and HTTPS server framework

Simple example:

from slinn import Server, Dispatcher, Filter, HttpResponse, Address


dp = Dispatcher()


@dp.route(Filter('/api.*'))
def api(request):
    return HttpResponse('{"status": "ok"}')


@dp.route(Filter('.*'))
def helloworld(request):
     return HttpResponse('Hello world!')


app = Server(dp, ssl_cert='fullchain.pem', ssl_key='key.pem')
app.listen(Address(8080))

Functions:

Server(self, *dispatchers, ssl_cert: str=None, ssl_key: str=None, http_ver: str='2.0')
Server.listen(self, address: Address)
Address(self, port: int, host: str=None)
Dispatcher(self, hosts: list=None)
Dispatcher.route(self, filter: Filter)
Filter(self, filter: str, methods: list[str]=None)
Filter.check(self, text: str, method: str) -> bool
HttpResponse(self, payload, data: list[tuple]=None, status: str='200 OK', content_type: str='text/plain')
HttpResponse.set_cookie(self, key: str, value)
HttpResponse.make(self, type: str='HTTP/2.0') -> str

HttpRedirect inherits from HttpResponse

HttpRedirect(self, location: str)
Request(self, http_data: str, client_address: tuple[str, int])

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

slinn-1.0.0.tar.gz (4.7 kB view details)

Uploaded Source

File details

Details for the file slinn-1.0.0.tar.gz.

File metadata

  • Download URL: slinn-1.0.0.tar.gz
  • Upload date:
  • Size: 4.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for slinn-1.0.0.tar.gz
Algorithm Hash digest
SHA256 c275262e297cac216f474487e228d84ddc8b3a77fd40ce386392ad53eeb16538
MD5 8f1a27c536b17b26412fe472c7d81154
BLAKE2b-256 00d8396ec32a10f4657a921c86441b8095fd93ca17a32f1187bac79ef8944d90

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