Webserver (with some utilities) made in sockets!
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.2.tar.gz
(5.0 kB
view details)
Built Distribution
File details
Details for the file WebLamp-0.2.2.tar.gz
.
File metadata
- Download URL: WebLamp-0.2.2.tar.gz
- Upload date:
- Size: 5.0 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 |
3d0dcb8373c92a3ce36bf9bb55f5b757165ad3bf39b31e4abf2c40baa0bd4582
|
|
MD5 |
e32f3fcd92cacf41def899a2af53b7e2
|
|
BLAKE2b-256 |
83f2e63605aae8e7fb34cf3525327d4fb3984e13e1eaaa82e354228541bf95d3
|
File details
Details for the file WebLamp-0.2.2-py3-none-any.whl
.
File metadata
- Download URL: WebLamp-0.2.2-py3-none-any.whl
- Upload date:
- Size: 6.3 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 |
39c966f5a4b7d52d0033c3361fd4cdb486cd65dc8aaad36619130f01c039c456
|
|
MD5 |
39baf6c65bbb5d1284cca732e5bfcb56
|
|
BLAKE2b-256 |
2695229227dcfa2c926757886625fbbc63fb1a25709dbdccbfdfb3a33f0526f2
|