pigeon.shortcuts¶
Module Contents¶
- pigeon.shortcuts.render(template, context: dict, status: int = 200) pigeon.http.HTTPResponse ¶
- pigeon.shortcuts.error(code: int, request: pigeon.http.request.HTTPRequest | None = None) pigeon.http.response.HTTPResponse | str ¶
Returns the HTTPResponse for the error code provided, request parameter optional
- pigeon.shortcuts.status(code)¶
- class pigeon.shortcuts.HTTPRequest(method: str, path: str, headers: dict = None, get: dict = None, data=None, files=None, protocol: str = '1.1', content_type=None, **kwargs)¶
Bases:
pigeon.http.message.HTTPMessage
An HTTP message (obv either response or request)
- property is_error¶
- class pigeon.shortcuts.HTTPResponse(headers: dict = None, data: str = None, status: int = 200, cookies=None, protocol: str = '1.1', content_type=None, **kwargs)¶
Bases:
pigeon.http.message.HTTPMessage
An HTTP message (obv either response or request)
- property is_error¶
- class pigeon.shortcuts.Log(name, color='#ffffff', subname='')¶
- max_name_length = 15¶
- off_color = '[#8888aa]'¶
- critical(*args, end='\n', subname='')¶
- error(*args, end='\n', subname='')¶
- warning(*args, end='\n', subname='')¶
- info(*args, end='\n', subname='')¶
- verbose(*args, end='\n', subname='')¶
- debug(*args, prefix='', end='\n', subname='')¶
- sublog(*args, color='white][/', end='\n')¶
For log messages that give extra context and details on the previous logmessage. They will only be logged if the previous log message was logged as well.
- action(*args, end='\n', subname='')¶
- ask_user(*args, end='', subname='')¶
Waits for input of user [y/n] returns True or False dependent on input