2. Task-Oriented Services

While the browser-oriented features of Century in the browser module and its sub-modules provides generic services for dealing with UF’s site (and potentially even other websites), the tasks module serves to accomplish specific goals, such as pulling a student’s home address from the UF phonebook (after proper authentication, of course), or looking up a student’s schedule (via ISIS, with that student’s GatorLink).

The point here is to build up a pool of ready-to-go components that can be used in larger applications without much fuss. Furthermore, tasks are not restricted to the browser.Browser namespace, and so rules governing their development are not as strict. For example, there are no limitations on dependencies here (within reason), while everything in browser is intended to be usable with nothing but the standard Python library. The point is that you can selectively choose which parts of Century you want to use, and pay the cost of extra dependencies as you go.

class lib.tasks.BaseTaskManager(browser=None)

Forms a simple system that can be used to create task handlers. This is an abstract class, although it has no abstract methods.

__init__(browser=None)
get_browser()

Gets the value of browser.

browser

The lib.browser.Browser instance passed into the constructor.

_get_new_browser()

An overridable factory to make a new lib.browser.Browser instance there isn’t one passed into __init__().

class lib.tasks.BaseRepeatedTaskManager(delay=300)

Designed to be used in multiple inheritance with BaseTaskManager, as to avoid a potential diamond-like inheritance hierarchy. This is an abstract class, with the abstract method, _run().

__init__(delay=300)
get_delay()

Gets the value of delay.

delay

The amount of time in seconds to wait between executions. For example, a delay of 300 would wait 5 minutes between each execution.

start(separate_thread=False)

Starts a new execution cycle. Note that the current task should be stopped with stop() before it is started (unless you are calling for the first time).

stop()

Stops the current execution cycle.

_run()

An abc.abstractmethod() that does the desired task when called on each execution cycle.

class lib.tasks.BaseUFTaskManager

Designed to be used in multiple inheritance with BaseTaskManager, as to avoid a potential diamond-like inheritance hierarchy.

__init__()
_get_new_browser()

Uses lib.browser.get_new_uf_browser() to make the default BaseTaskManger.browser instance.

Previous topic

1.2.2.7.2. isis – Tools for Working With ISIS (Integrated Student Information System)

This Page