HTTP client/server utilities
This module contains some helpers to deal with the real http
world.
-
class
webtest.http.
StopableWSGIServer
(application, *args, **kwargs)[source]
StopableWSGIServer is a TcpWSGIServer which run in a separated thread.
This allow to use tools like casperjs or selenium.
Server instance have an application_url
attribute formated with the
server host and port.
-
classmethod
create
(application, **kwargs)[source]
Start a server to serve application
. Return a server
instance.
-
run
()[source]
Run the server
-
shutdown
()[source]
Shutdown the server
-
wait
(retries=30)[source]
Wait until the server is started
-
wrapper
(environ, start_response)[source]
Wrap the wsgi application to override some path:
/__application__
: allow to ping the server.
/__file__?__file__={path}
: serve the file found at path
-
webtest.http.
check_server
(host, port, path_info='/', timeout=3, retries=30)[source]
Perform a request until the server reply