Skip to main content

Slinn

Slinn is an HTTP server framework
License GitHub top language
GitHub Release GitHub repo size GitHub Repo stars

Simple example

from slinn import (
    ApiDispatcher, AnyFilter, AsyncRequest, HttpResponse,
    HttpRedirect, HttpJSONResponse
)


dp = ApiDispatcher()


@dp.get('api/<str method>')
async def api(request: AsyncRequest, method: str) -> HttpResponse:
    return HttpJSONResponse(
        status='ok',
        method=method,
        ip=request.ip
    )

@dp.get()
@dp.get('index')
async def index() -> HttpResponse:
    return HttpRedirect('/helloworld')


@dp(AnyFilter)
async def helloworld() -> HttpResponse:
     return HttpResponse('Hello world!')

Begin project

Standart

slinn-admin create-project www
cd www
venv/bin/activate
slinn create-app localhost host=localhost host=127.0.0.1

Insert example into localhost/app.py file, then run start.bat or start.sh script

[!TIP] Instead of use example, create app from template slinn template example

Expected output

Loading config...
Apps: firstrun
Debug mode enabled
Smart navigation enabled

Starting server...
HTTP server is available on http://localhost:8080/

To config project you should edit ./project.json

To config app you should edit ./%app%/config.json

Classic

Unix-like (Linux, MacOS, FreeBSD...):
mkdir helloworld 
cd helloworld
python3 -m venv venv
venv/bin/activate
Windows:
mkdir helloworld 
cd helloworld
python3 -m venv venv
venv\Scripts\activate

Insert example into ./example.py and add following code:

from slinn import AsyncServer
import asyncio
asyncio.run(AsyncServer(dp).listen(Address(8080)))

then write python example.py

Expected output

helloworld $ venv/bin/python example.py
HTTP server is available on http://localhost:8080/

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

slinn-2.3.9.tar.gz (89.5 kB view details)

Uploaded Source

Built Distribution

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

slinn-2.3.9-py3-none-any.whl (133.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: slinn-2.3.9.tar.gz
  • Upload date:
  • Size: 89.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.4.1 CPython/3.15.0b4 Windows/11

File hashes

Hashes for slinn-2.3.9.tar.gz
Algorithm Hash digest
SHA256 0fe74f449c550b97669a5ce9e3dac9e4254d817ebd3dca2562cb0a6b8594150e
MD5 1950c9784224b1a3af67b38ff203e1c9
BLAKE2b-256 f47478f98e7b383abd2960d84334d5c99fc246a4dd5e2f97231c075e2f2a52b3

See more details on using hashes here.

File details

Details for the file slinn-2.3.9-py3-none-any.whl.

File metadata

  • Download URL: slinn-2.3.9-py3-none-any.whl
  • Upload date:
  • Size: 133.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.4.1 CPython/3.15.0b4 Windows/11

File hashes

Hashes for slinn-2.3.9-py3-none-any.whl
Algorithm Hash digest
SHA256 470c7fcbf785578f87426314e3787b0ebe646c5e7be4bc0d09857f0c2dde5034
MD5 6b04cac4fa5a56a472de14b5167e1667
BLAKE2b-256 db9f4eb41294797750930895882c17b24cda97d0c276bf763e3ff3a108cc5d1a

See more details on using hashes here.

Release history Release notifications | RSS feed

2.3.10

2 files

This release

2.3.9 This release

2 files

2.3.8

2 files

2.3.7

2 files

2.3.6

2 files

2.3.5

2 files

2.2.15

1 file

2.2.14

1 file

2.2.13

1 file

2.2.12

1 file

2.2.11

1 file

2.2.10

1 file

2.2.9

1 file

2.2.8

1 file

2.2.7

1 file

2.2.6

1 file

2.2.5

1 file

2.2.4

1 file

2.2.3

1 file

2.2.2

1 file

2.2.0

1 file

2.1.2

1 file

2.1.1

1 file

2.1.0

1 file

2.0.1

1 file

2.0.0

1 file

1.2.1

1 file

1.2.0

1 file

1.1.7

1 file

1.1.6

1 file

1.1.5

1 file

1.1.4

1 file

1.1.3

1 file

1.1.2

1 file

1.1.1

1 file

1.1.0

1 file

1.0.0

1 file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page