API documentation¶
Backends¶
The role of a backend is to handle the communication with a backend tool that will store the timesheets and provide projects and activities.
-
class
taxi.backends.BaseBackend(username, password, hostname, port, path, options, context)¶ All Taxi backends should inherit from the
BaseBackendclass. Backends are usually constructed from a URL in the form <backend_name>://<username>:<password>@<hostname>:<port><path>?<options>. ThePluginsRegistrytakes care of the parsing and the instanciation of the backend objects. The options parameter is a dictionary constructed from the backend URL querystring.Construct the backend.
-
get_projects()¶ Return a list of projects and activities. These will be then stored for further use. The list should contain
Projectobjects.
-
post_push_entries()¶ Called after the entries have been pushed. Useful if you need to do post-processing like closing connection, or sending entries buffered in
push_entry().If an exception is raised in this method, the status of all the entries of the backend will be considered failed. You can also raise
PushEntriesFailedwith a custom user message to mark their status as failed. If you want to mark individual entries as failed, raisePushEntriesFailedwithentriesbeing a dictionary containing entries as keys, and error messages as values.
-
push_entry(date, entry)¶ Called when an entry should be pushed to the backend. date is a
datetime.dateobject. entry is aTimesheetEntryobject.If the push fails, this method should raise a
PushEntryFailedexception.
-
-
exception
taxi.backends.PushEntriesFailed(message=None, entries=None)¶ Exception indicating that a set of entries couldn’t be pushed. Typically raised by
BaseBackend.post_push_entries().If
entriesis set, it should be a dictionary mappingtaxi.timesheet.entry.TimesheetEntrywith errors as strings.
-
exception
taxi.backends.PushEntryFailed¶ Exception indicating that an entry couldn’t be pushed.