Skip to content
Iury O. G. Figueiredo edited this page Dec 4, 2020 · 3 revisions

Welcome to the websnake wiki!

Websnake is a Web requests tool to make life easier when handling more complex scenaries when fetching content from the Web.

It is built on top of Untwisted Framework thus it takes some advantages of Untwisted event driven design. Websnake users would feel more comfortable once a short description of Websnake classes were exposed.

Here it goes.

The class below is responsible for holding the Web Server content. It has data structures that are related to the previously performed request.

websnake.Response

This attribute holds the headers that were sent by the Web Server.

Response.headers

The above attribute is an instance of the class.

websnake.Headers

There is the class below that is a base class for all request methods in websnake.

websnake.Request

Every Request instance is an event emitter, that means that when events happen then handles are called with specific arguments to characterize the events itself.

In Websnake a Web Server response code is turned into an event thus it is possible to get handles mapped to specific response codes.

Consider the situation that it is necessary to get a callback executed when a server responds with status code 400 and other handle to be called when the server responds with status code 200.

Websnake makes it possible to be done in a simpler but powerful manner.

request = Get(url) 
request.add_map('200', handle0)
request.add_map('400', handle1)

The class below is responsible for dealing with connections also parsing responses.

ResponseHandle

That is an extension that is responsible for receiving responses and firing its respective events.

The class below makes a Get request.

websnake.Get

The Post request.

websnake.Post

The Put request.

websnake.Put

The Delete request.

websnake.Delete

The Head request.

websnake.Head

The next class is used to take action when specific requests are finished.

websnake.RequestPool

This one is used to dump json through a request.

websnake.JSon

This one is used to send regular form encoded values.

websnake.FormData

Used to perform basic authentication.

websnake.BasicAuth

The token based authentication.

websnake.TokenAuth