Package pysmug :: Module smugmug :: Class SmugBase
[hide private]
[frames] | no frames]

Class SmugBase

source code

object --+
         |
        SmugBase
Known Subclasses:
SmugBatch, SmugMug

Abstract functionality for SmugMug API clients.

Instance Methods [hide private]
 
__init__(self, sessionId=None, protocol='https')
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
source code
 
__getattr__(self, method)
Construct a dynamic handler for the SmugMug API.
source code
 
_make_handler(self, method) source code
 
_new_connection(self, url, args)
Prepare a new connection.
source code
 
_handle_response(self, c)
Handle the response from SmugMug.
source code
 
_perform(self, c) source code
 
batch(self, protocol=None)
Return an instance of a batch-oriented SmugMug client.
source code
 
images_upload(self, AlbumID=None, ImageID=None, Data=None, FileName=None, **kwargs)
Upload the corresponding image.
source code

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__

Instance Variables [hide private]
  protocol
Communication protocol -- either http or https
  sessionId
Session id from smugmug.
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, sessionId=None, protocol='https')
(Constructor)

source code 
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
Overrides: object.__init__
(inherited documentation)

_new_connection(self, url, args)

source code 

Prepare a new connection.

Create a new connection setting up the query string, user agent header, response buffer and ssl parameters.
Parameters:
  • url - complete query string with parameters already encoded
  • args - arguments passed to method to be used for later callbacks

_handle_response(self, c)

source code 

Handle the response from SmugMug.

This method decodes the JSON response and checks for any error condition. It additionally adds a Statistics item to the response which contains upload & download times.
Parameters:
  • c (PycURL Curl) - a completed connection
Returns:
a dictionary of results corresponding to the SmugMug response
Raises:

images_upload(self, AlbumID=None, ImageID=None, Data=None, FileName=None, **kwargs)

source code 

Upload the corresponding image.

One of ImageID or AlbumID must be present, but not both.
Parameters:
  • Data - the binary data of the image
  • ImageID - the id of the image to replace
  • AlbumID - the name of the album in which to add the photo
  • FileName - the name of the file