Webpet
Simple async web framework for python
This is my pet project and it doesn't pretend to be serious
Links
Simple Usage example
from webpet.application import ASGIApplication
from webpet.conf import Configuration
from webpet.response import HTTPResponse
from webpet.routers import HTTPRouter, URL
from webpet.views import View, LongPoolView, TemplateView
import asyncio
import json
import random
import os
BASE_DIR = os.getcwd() + '/'
class Index(TemplateView):
template_name = 'index.html'
class Aboba(View):
async def get(self):
raise ValueError()
class TestLong(LongPoolView):
async def get(self):
await self.open(status_code=200, headers=[(b'Content-type', b'application/json')])
data = []
ticks = 0
while True:
ticks += 1
number = random.randint(0, 1000)
data.append(number)
if number >= 500:
await self.send(HTTPResponse(
json.dumps({
'data': data,
'ticks': ticks
})
))
break
else:
await asyncio.sleep(1)
router = HTTPRouter(routes=[
URL('/', Index),
URL('/aboba', Aboba),
URL('/longpool', TestLong)
])
configuration = Configuration()
configuration.router = router
configuration.templates_dir = BASE_DIR + 'templates/'
app = ASGIApplication()
To run with daphne use
pip install daphne
daphne <application_name>:<ASGIApplication instance>
Metadata
Release files for webpet 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| webpet-0.1.1.tar.gz | 3.5 kB | Without provenance | Details for webpet-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| webpet-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for webpet-0.1.1-py3-none-any.whl |
Total release size: 7.4 kB
Release files / webpet-0.1.1.tar.gz
| Download URL | webpet-0.1.1.tar.gz |
|---|---|
| Size | 3.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d5655dda7fc4aabbe7aba61b6ad2fd72cb00a8aeb67c731b0924965ec385daaf
|
|
BLAKE2b-256 checksum How to use checksums |
8facf510308d72ce0c9eb9ca876fe61ff127436517ba668ed97d501a88373a02
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7
|
Release files / webpet-0.1.1-py3-none-any.whl
| Download URL | webpet-0.1.1-py3-none-any.whl |
|---|---|
| Size | 3.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4302a46b8a26c5a31cbcfe6a8831530a08c7dbe8e5a775ccd12f4ed2659e6854
|
|
BLAKE2b-256 checksum How to use checksums |
78b6df30e9a1432494c019dcf1b7cabeb09f717bc92a37ebd358c56a6a8c8fad
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7
|
Security for webpet 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.