Waldir Pimenta edited this page May 31, 2014 · 1 revision
Clone this wiki locally

Site.Images is a PageList object that provides access to the Image object for any file on a site, as in:

page = site.Images['Apple.jpg']
text = page.[[Page.edit|edit]]()

When using Images, unlike when using Site.Pages, the "File:" or "Image:" namespace prefix is not required.

It also permits iteration over all files on a site:

for page in site.Images:
    print page.[[Page.page_title|page_title]]

For a large site with many files, this kind of loop can take a long time to run.

To access other types of pages, use Site.Pages or Site.Categories.

This page was originally imported from the old mwclient wiki at SourceForge. The imported version was dated from 09:16, 25 November 2011, and its only editor was Derrickcoetzee (@dcoetzee).