Response Headers - Head

Often times you hopefully won’t have to directly make a Head object for your response, since the framework and base controller takes care of this for you for you most of the time. However the Head` class provides some utilities to make dealing with response headers a little easier.

class seshat.head.Head(status='200 OK', headers=None, errors=None)[source]

Gives a basic container for the headers within a request.

status = None

To change the status at anytime, you can simply just assign it a new value.

errors = None

If an error was encounters then the stack trace will end up here

reset_headers()[source]

Allows you to reset the headers

add_header(key, value)[source]

Allows you to add a new header to the list

Eg:

add_header("location", "/")

will result in the tuple ("location", "/") being added to the list of headers to be returned.

Parameters:
  • key – The header name
  • value – The header value