Skip to content

base

Utility functions and types.

Attributes

DEFAULT_SOURCE = 'pyrevit.routes' module-attribute

Classes

Request(path='/', method='GET', data=None, params=None)

Bases: object

Request wrapper object.

Source code in pyrevitlib/pyrevit/routes/server/base.py
def __init__(self, path='/', method='GET', data=None, params=None):
    self.path = path
    self.method = method
    self.data = data
    self._headers = {}
    self._params = params or []

Attributes

path = path instance-attribute
method = method instance-attribute
data = data instance-attribute
headers property

Request headers dict.

params property

Request parameters.

callback_url property

Request callback url, if provided in payload.

Functions

add_header(key, value)

Add new header key:value.

Source code in pyrevitlib/pyrevit/routes/server/base.py
def add_header(self, key, value):
    """Add new header key:value."""
    self._headers[key] = value

Response(status=200, data=None, headers=None)

Bases: object

Response wrapper object.

Source code in pyrevitlib/pyrevit/routes/server/base.py
def __init__(self, status=200, data=None, headers=None):
    self.status = status
    self.data = data
    self._headers = headers or {}

Attributes

status = status instance-attribute
data = data instance-attribute
headers property

Response headers dict.

Functions

add_header(key, value)

Add new header key:value.

Source code in pyrevitlib/pyrevit/routes/server/base.py
def add_header(self, key, value):
    """Add new header key:value."""
    self._headers[key] = value