Welcome to thorium’s documentation!¶
Contents:
API Reference¶
If you are looking for information on a specific function, class or method, this part of the documentation is for you.
API Reference¶
Thorium Object¶
-
class
thorium.
Thorium
(settings, route_manager, debug=False)¶ -
logger
¶ A
logging.Logger
object for this application.
-
Routing¶
-
class
thorium.
Route
(name, path, dispatcher)¶ An object to hold the relationship between a url path and the dispatcher that handles requests to that path.
Note: To add a route after creation use the
add_route()
method.Parameters: - name – The name to associate with this route
- path – The relative to base url path to access the resource, sometimes referred to as endpoint
- dispatcher – A
Dispatcher
object to handle the request
-
class
thorium.
RouteManager
¶ Manages the list of
Route
‘s needed byThorium
. Register your resources using eitherregister_resource()
or buildRoute
‘s manually and add them withadd_route()
.
Resource¶
-
class
thorium.
Resource
(*args, **kwargs)¶ -
from_obj
(obj, mapping=None, override=None, cast=False)¶ Maps the public attributes from a object to the resource fields based on identical names. Optional mapping parameter allows for discrepancies in naming with resource names being the key and the object attribute name to map to being the value. If explicit_mapping is True, only the attributes in the mapping dictionary will be copied. An optional override dictionary is used to set values explicitly.
-
to_obj
(obj, mapping=None, override=None)¶ Maps the fields from the resource to an object based on identical names. Optional mapping parameter allows for discrepancies in naming with resource names being the key and the object attribute name to map to being the value. If explicit_mapping is True, only the attributes in the mapping dictionary will be copied.
-
Endpoints¶
-
class
thorium.
Endpoint
(request, response)¶ Responsible for the implementation of a single
Resource
, The methods provide hooks which will be called into by the dispatcher during a request.Parameters: - request – A
Request
object. - response – A
Response
object.
- request – A
-
class
thorium.
Parameters
¶
Request¶
-
class
thorium.
Request
(dispatcher, method, identifiers, query_params, mimetype, resource, resources, url)¶
ThoriumFlask¶
-
class
thorium.
ThoriumFlask
(settings, route_manager, flask_app)¶ -
logger
¶ A
logging.Logger
object for this application.
-