wsgi_tools.parser module

This module includes WSGI-apps, which parse content and call another WSGI-app.

Do not use

environ['wsgi.input'].read()

except in these parsers.

If you want the raw bytes content, you can use:

parser.raw_content
class wsgi_tools.parser.JSONParser(app)

Bases: object

A WSIG app, which parses json from the content.

Parameters

app – The WSGI-app, the parser will forward.

property json_content

the json content

property raw_content

the raw content of the body

Type

bytes

class wsgi_tools.parser.XMLParser(app)

Bases: object

A WSIG app, which parses xml from the content.

Parameters

app – The WSGI-app, the parser will forward.

property raw_content

the raw content of the body

Type

bytes

property root_element

the root element of the xml element-tree

Type

ET.Element