This docs are generated from the docstirngs. Apart from that, feel free to study source code directly.
The core class that is used to create and start server
Parameters: |
|
---|
Example:
app = Application({
'/': HelloHandler(),
})
app.run()
Starts server on host and port given in settings, adds Ctrl-C signal handler.
Parameters: |
|
---|
Used by HTTPServer to react for some url pattern.
All handling happens in handle method.
May be an asyncio.coroutine or a regular function
Parameters: |
|
---|---|
Return type: | str (may be rendered with self.render()) or rainfall.http.HTTPError |
Uses jinja2 to render a template
Parameters: |
|
---|---|
Return type: | rendered string |
Http server itself, uses asyncio.Protocol. Not meant to be created manually, but by rainfall.web.Application class.
Representes different http errors that you can return in handlers.
Parameters: | code – http error code |
---|
Rainfall implementation of the http request.
Parameters: | raw – raw text of full http request |
---|
Return type: | dict, GET arguments |
---|
Return type: | dict, POST arguments |
---|
Return type: | str, http body |
---|
Return type: | dict, http headers |
---|
Return type: | str, http method |
---|
Return type: | str, http url |
---|
Use it for your rainfall test cases. In setUp rainfall server is starting in the separate Process.
You are required to specify an app variable for tests. E.g.
from example import my_first_app
class HTTPTestCase(RainfallTestCase):
app = my_first_app
def test_basic(self):
r = self.client.query('/')
self.assertEqual(r.status, 200)
self.assertEqual(r.body, 'Hello!')
Inside you can use TestClient’s instance via self.client