producti_gestio.handlers package¶
producti_gestio.handlers module¶
producti_gestio.handlers¶
That’s the handlers part of the module. It contains handlers that could be used to check and get requests.
producti_gestio.handlers.handler¶
It contains the main handler that could be used to check and get requests.
-
class
producti_gestio.handlers.handler.
Handler
(callback: <function NewType.<locals>.new_type at 0x7f5865686c80>, filters: producti_gestio.filters.filter.Filter = None)¶ Bases:
object
It’s the main Handler, it could be used to check if the request using filters.
It is used by
producti_gestio.server.server.add_handler()
to create a newHandler
.Here an example:
from producti_gestio import Server from producti_gestio.handlers.handler import Handler my_server = Server(allow_get=True) # Create the Server instance. my_handler = Handler(lambda parameters: bool(parameters['path'] == '/test')) # Create the handler my_server.add_handler(my_handler) # Add the handler to the Server object my_server.start() # Run the server using threads
-
__init__
(callback: <function NewType.<locals>.new_type at 0x7f5865686c80>, filters: producti_gestio.filters.filter.Filter = None) → None¶
-
check
(parameters) → bool¶ It checks if the request is valid using filters.
Parameters: parameters (dict) – The request handler parameters Returns: True if the request is valid, False if not Return type: bool
-
filters
= None¶
-