flicker is a Python web framework , based on libevent. using non-blocking network I/O flicker is Pythonic framework, easily write a web service and code is easy understand
from flicker.base import HTTP_200_Code
from flicker.httphandler import HttpHandler
from flicker.web import Application
from flicker.httpserver import HttpServer
web = Application()
@web.route(r"/")
class TestHandler(HttpHandler):
def get(self, *args, **kwargs):
self.write(HTTP_200_Code, "<h1>Hello world</h1>")
server = HttpServer("localhost", 8000, web)
server.start()
-
TcpServer define a basic tcp server that use libevent
-
HttpServer is subclass of tcp server, listen and deal http request
- headers
- _cookie
- path
- protocol
- query
- body
- sock
- protocol
- message
- headers
- _cookie
- address
- status_code
- request
- address
- response
- protocol
- message
- headers
- _cookie
- set_header
- get_header
- set_cookie
- get_cookie
- cookies
- get
- post
- ...
Application
extended the libevent module of c
cd flicker/libevent & python setup.py install
python setup.py install