Outdated version of the documentation. Find the latest one here.

PyQGIS cookbook