Package pywikipedia :: Module lib_images
[show private | hide private]
[frames | no frames]

Module pywikipedia.lib_images

Library with functions needed for image treatment
Function Summary
  encode_multipart_formdata(fields, files)
fields is a sequence of (name, value) elements for regular form fields.
  get_content_type(filename)
  get_image(original_url, source_site, original_description, keep, debug)
Gets the image at URL original_url, and uploads it to the home Wikipedia.
  post_multipart(host, selector, fields, files, cookies)
Post fields and files to an http host as multipart/form-data.
  transfer_image(imagelink, debug)
Gets a wikilink to an image, downloads it and its description, and uploads it to another wikipedia.

Imported modules:
pywikipedia.config, httplib, md5, pywikipedia.mediawiki_messages, os, re, string, sys, pywikipedia.wikipedia
Imported variables:
copy_message
Function Details

encode_multipart_formdata(fields, files)

fields is a sequence of (name, value) elements for regular form fields. files is a sequence of (name, filename, value) elements for data to be uploaded as files Return (content_type, body) ready for httplib.HTTP instance

get_image(original_url, source_site, original_description, keep=False, debug=False)

Gets the image at URL original_url, and uploads it to the home Wikipedia. original_description is the proposed description; if description is empty (''), asks for a description. source_site is the site the image is loaded from. if source_site is None, it indicates that the image is uploaded directly from the user's harddisk (via upload.py). Returns the filename which was used to upload the image If the upload fails, the user is asked whether to try again or not. If the user chooses not to retry, returns null.

post_multipart(host, selector, fields, files, cookies)

Post fields and files to an http host as multipart/form-data. fields is a sequence of (name, value) elements for regular form fields. files is a sequence of (name, filename, value) elements for data to be uploaded as files Return the server's response page.

transfer_image(imagelink, debug=False)

Gets a wikilink to an image, downloads it and its description, and uploads it to another wikipedia. Returns the filename which was used to upload the image This function is used by imagetransfer.py and by copy_table.py

Generated by Epydoc 2.1 on Sun Jul 03 17:07:37 2005 http://epydoc.sf.net