Skip to main content

Makes it quick to make HTTP servers

Project description

# lazyhttp

Drop in replacement for `http.server` with convenience methods added.

```python
import json
import http.server

import lazyhttp

class Handler(lazyhttp.Handler):

def req(self, task):
if '/create' in self.path or '/update' in self.path and \
self.has(task, 'id', 'text'):
TASKS[task['id']] = task
elif '/delete' in self.path and self.has(task, 'id'):
del TASKS[task['id']]
elif '/get' in self.path and self.has(task, 'id'):
self.json(TASKS[task['id']])
elif '/all' in self.path:
self.json(TASKS)
else:
self.err('Nothing to do')

if __name__ == '__main__':
lazyhttp.run(Handler)
```

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

lazyhttp-0.0.3.tar.gz (2.5 kB view details)

Uploaded Source

File details

Details for the file lazyhttp-0.0.3.tar.gz.

File metadata

  • Download URL: lazyhttp-0.0.3.tar.gz
  • Upload date:
  • Size: 2.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for lazyhttp-0.0.3.tar.gz
Algorithm Hash digest
SHA256 f5d637fcc0b1d0bc0291bcba5d4e72df47dff1eecf6d943e54041ddd23619eac
MD5 b9d8c4e0db6ae44e7238c67d88a6b704
BLAKE2b-256 a691eddd90219597d15173da38a874472f2eb86e94e909786100c2aea72f714d

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page