1.2.2. plugins – Extending the browser Module

Plugins are things that add functionality to the browser. Some of them are not site-specific, and could be used in a variety of applications, such as the lib.browser.plugins.cookies, or the lib.browser.plugins.keepalive plugins. UF-specific plugins are kept within the lib.browser.plugins.uf package. Plugins are different from lib.tasks, for a few reasons:

  • A plugin has direct access to more of the browser’s features.
  • A plugin typically does something simpler than a task.
  • A plugin has to be careful about what it overrides, as it could create serious problems if poorly implemented.

If you don’t know what you’re doing, but you want to add more functionality to the library, I’d suggest writing a task, but for certain things, a plugin becomes a more elegant solution.

Plugins for lib.browser.Browser can do a variety of things, such as adding new methods to a lib.browser.Browser instance, adding new properties, overriding old methods or properties, adding handlers, and adding headers to future HTTP requests. The lib.browser.plugins.decorators module provides some useful decorators for making this happen.

Previous topic

1.2.1. parsers – Generic Webpage Parsers for the browser Module

Next topic The Plugin Architechure

This Page