Python API reference

phoupl – Public interface

Photo-Uploader module

phoupl.SERVICE_DB = {'imageshack.us': {'Features': ['new'], 'URL': 'http://imageshack.us/', 'Languages': ['eng'], 'FullName': 'ImageShack', 'Type': 'storage', 'Class': <class phoupl.services.imageshack.ImageShackService at 0x23ee7a0>}, 'happyfoto.cz': {'Features': ['new'], 'Countries': ['cz'], 'URL': 'http://happyfoto.cz/', 'Languages': ['cze'], 'FullName': 'Happy Foto.cz', 'Type': 'digilab', 'Class': <class phoupl.services.happyfoto-cz.HappyFotoCZService at 0x23dece8>}, 'uloz.to': {'Features': ['new'], 'URL': 'http://uloz.to/', 'Languages': ['cze'], 'FullName': 'Uloz.to', 'Type': 'storage', 'Class': <class phoupl.services.ulozto.UlozToService at 0x23ee8d8>}, 'happyfoto.sk': {'Features': ['new'], 'Countries': ['sk'], 'URL': 'http://happyfoto.sk/', 'Languages': ['svk'], 'FullName': 'Happy Foto.sk', 'Type': 'digilab', 'Class': <class phoupl.services.happyfoto-sk.HappyFotoSKService at 0x23f36d0>}, 'postimage.org': {'Features': ['new'], 'URL': 'http://postimage.org/', 'Languages': ['eng'], 'FullName': 'PostImage', 'Type': 'storage', 'Class': <class phoupl.services.postimg.PostImageService at 0x23e5c80>}}

Dictionary holding all available services.

phoupl.get_service_info(name)

Returns information about service.

Parameters:name (string) – Name of service.
phoupl.list_services()

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.

Parameters:
  • 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.

connect()

Connects if you are not already connected.

do_request()

Performs request using current cURL configuration.

dump_request()

Dumps request data if debug is enabled.

get(url)

Performs GET request on URL.

get_features()

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

Features are described in README.

get_review_url()

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

get_session()

Returns currently used session.

get_url()

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)

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