Python API reference

phoupl – Public interface

Photo-Uploader module

phoupl.SERVICE_DB = {'': {'Features': ['new'], 'URL': '', 'Languages': ['eng'], 'FullName': 'ImageShack', 'Type': 'storage', 'Class': <class at 0x23ee7a0>}, '': {'Features': ['new'], 'Countries': ['cz'], 'URL': '', 'Languages': ['cze'], 'FullName': 'Happy', 'Type': 'digilab', 'Class': <class at 0x23dece8>}, '': {'Features': ['new'], 'URL': '', 'Languages': ['cze'], 'FullName': '', 'Type': 'storage', 'Class': <class at 0x23ee8d8>}, '': {'Features': ['new'], 'Countries': ['sk'], 'URL': '', 'Languages': ['svk'], 'FullName': 'Happy', 'Type': 'digilab', 'Class': <class at 0x23f36d0>}, '': {'Features': ['new'], 'URL': '', 'Languages': ['eng'], 'FullName': 'PostImage', 'Type': 'storage', 'Class': <class at 0x23e5c80>}}

Dictionary holding all available services.


Returns information about service.

Parameters:name (string) – Name of service.

Returns list of available services.

phoupl.register_service(name, handler, url='', features=None, fullname=None, countries=None, languages=None, servicetype='digilab')

Registration handler for adding service.

Parameters handler, url and features should be allways filled, rest is optional.

  • handler (Class) – Class to handle uploads.
  • url – URL with service information.
  • features (list of strings) – Features supported by service, check README for their listing.
  • fullname (string) – Printable name of service. This should be unique among all services in one country.
  • countries (list of strings) – List of countries where service is available as ISO 3166 codes.
  • languages (list of strings) – List od languages as ISO 639-2 language codes supported by service.
  • servicetype (string, currently one of digilab, storage) – Type of service
phoupl.upload_photos(service, images, debug=False, msgcallback=None, session=None, configstorage=None)

Uploads photos to defined service.

phoupl.core – Core functionatily

Photo-Uploader core. Generic class for uploading photos, no real functionality, just wrapping cURL and image uploading.

exception phoupl.core.NotConfigured

Raised when configuration is missing.

exception phoupl.core.PhoUplNotImplemented

Raised when some functionality not implemented by plugin.

class phoupl.core.PhotoUploader(debug=False, msgcallback=None, session=None, config=None)

Generic photo uploader class for handling photo uploads.


Connects if you are not already connected.


Performs request using current cURL configuration.


Dumps request data if debug is enabled.


Performs GET request on URL.


Returns list of supported features. You should implement this in subclass.

Features are described in README.


Returns URL suitable for review/finishing order. You should implement this in subclass.


Returns currently used session.


Returns URL with information about service. You should implement this in subclass.

This function can return either string of list of strings.

msg(text, noeol=False)

Prints message to user.

post(url, params=None)

Performs POST request on URL with parameters.


Upload images listed in images parameter. List should contain paths to files.

exception phoupl.core.UploadFailed

Raised when upload fails.

phoupl.config – Configuration handling

Photo-Uploader configuration manager.

class phoupl.config.Config(filename, defaults=None)

Configuration handler for photo-uploader. It only wraps ConfigParser to make it more convenient to use.

get(section, option)

Reads string value from configuration, if it is not found, it tries to apply defaults, if even this fails, exception is raised.

getbool(section, option)

Reads boolean value from configuration, if it is not found, it tries to apply defaults, if even this fails, exception is raised.

getint(section, option)

Reads integer value from configuration, if it is not found, it tries to apply defaults, if even this fails, exception is raised.

Table Of Contents

Previous topic

photo-upload command line reference

This Page