A socket webserver made in python!
Project description
Lamp
An asynchronous webserver made with sockets! (Not Finished)
Examples of using Lamp:
from WebLamp import Lamp, Connection
server = Lamp()
@server.route(path = '/', method = ['GET'])
async def home(conn: Connection) -> tuple:
return 200, b'Hello World!'
server.run(("127.0.0.1", 5000))
1 unique thing about this webserver is you can use a regex in your route and domain!
from WebLamp import Lamp, Connection
import re
server = Lamp()
@server.route(path = re.compile(r'^/u/(?P<userid>[0-9]*)$'), method = ['GET'])
async def home(conn: Connection) -> tuple:
userid = conn.args['userid'] # this came from the regex that was provided
return 200, userid.encode()
server.run(("127.0.0.1", 5000))
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
WebLamp-0.2.6.tar.gz
(4.9 kB
view details)
Built Distribution
File details
Details for the file WebLamp-0.2.6.tar.gz
.
File metadata
- Download URL: WebLamp-0.2.6.tar.gz
- Upload date:
- Size: 4.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.55.1 CPython/3.8.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
71a695f0bec8d7d8102a8f9ff382d285c6de7657c09b6a39c329d874538e8d14
|
|
MD5 |
3a0d317913107ffb0c447613e75074ad
|
|
BLAKE2b-256 |
626910ef28c30913474b48e99e8f63aad05a966157a18a6ffa43bed7d4e68a6b
|
File details
Details for the file WebLamp-0.2.6-py3-none-any.whl
.
File metadata
- Download URL: WebLamp-0.2.6-py3-none-any.whl
- Upload date:
- Size: 6.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.55.1 CPython/3.8.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
6a05418d53f7de7e9eede40c3d267f2672253e9863fa799bd4d8b9a817d202fc
|
|
MD5 |
0223c48f349884bbc3ee4defb2721f6d
|
|
BLAKE2b-256 |
0028e51524889885178d90f48ace8451a22ebb6a5f13f68e7e8e8ab9e887ba52
|