pysmug.smugmug.SmugBatch

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

# Class SmugBatch

source code

    object --+
             |
      SmugBase --+
                 |
                SmugBatch

Batching version of a SmugMug client.

Instance Methods | [hide private]
__init__(self, *args, **kwargs) x.__init__(...) initializes x; see x.__class__.__doc__ for signature | source code
_perform(self, c) Store the request for later processing. | source code
__len__(self) | source code
__call__(self, n=None) Execute all pending requests. | source code
_handle_response(self, c) Catch any exceptions and return a valid response. | source code
_multi(self, batch, func, n=None) Perform the concurrent execution of all pending requests. | source code
images_download(self, **kwargs) Download the entire contents of an album to the specified path. | source code
Inherited from `SmugBase`: `__getattr__`, `batch`, `images_upload` Inherited from `SmugBase` (private): `_make_handler`, `_new_connection`, `_prepare_keywords` Inherited from `object`: `__delattr__`, `__getattribute__`, `__hash__`, `__new__`, `__reduce__`, `__reduce_ex__`, `__repr__`, `__setattr__`, `__str__`

Instance Variables | [hide private]
list<PycURL `Curl`> | _batch list of requests pending executions
int | concurrent number of concurrent requests to execute
Inherited from `SmugBase`: `proxy`, `secure`, `sessionId`

Properties | [hide private]
Inherited from `SmugBase`: `protocol` Inherited from `object`: `__class__`

Method Details | [hide private]

### __init__(self, *args, **kwargs) (Constructor) | source code
x.__init__(...) initializes x; see x.__class__.__doc__ for signature Overrides: object.__init__ (inherited documentation)

### _perform(self, c) | source code
Store the request for later processing. Parameters: `c` - a pending request Overrides: SmugBase._perform

### __call__(self, n=None) (Call operator) | source code
Execute all pending requests. Parameters: `n` (int) - maximum number of simultaneous connections Returns: a generator of results from the batch execution - order independent

### _handle_response(self, c) | source code
Catch any exceptions and return a valid response. Parameters: `c` (PycURL `Curl`) - a completed connection Returns: a dictionary of results corresponding to the SmugMug response Raises: `SmugMugException` - if an error exists in the response Overrides: SmugBase._handle_response

### _multi(self, batch, func, n=None) | source code
Perform the concurrent execution of all pending requests. This method iterates over all the outstanding working at most `n` concurrently. On completion of each request the callback function `func` is invoked with the completed PycURL instance from which the `params` and `response` can be extracted. There is no distinction between a failure or success reponse, both are `yield`ed. After receiving all responses, the requests are closed. Parameters: `batch` (list<PycURL `Curl`>) - a list of pending requests `func` - callback function invoked on each completed request `n` (int) - the number of concurrent events to execute

### images_download(self, **kwargs) | source code
Download the entire contents of an album to the specified path. This method is not a standard smugmug method. Parameters: `albumId` - the album to download `path` - the path to store the images `format` - the size of the image (check smugmug for possible sizes) Returns: a generator of responses containing the filenames saved locally