pysmug.smugmug.SmugBase

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

# Class SmugBase

source code

    object --+
             |
            SmugBase

Known Subclasses:
  - SmugMug
  - , SmugBatch

Abstract functionality for SmugMug API clients.

Instance Methods | [hide private]
__init__(self, sessionId=None, secure=True, proxy=None) 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) Execute the request. | source code
_prepare_keywords(self, **kwargs) Prepare the keywords for sending to SmugMug. | source code
batch(self) Return an instance of a batch-oriented SmugMug client. | source code
images_upload(self, **kwargs) Upload the corresponding image. | source code
Inherited from `object`: `__delattr__`, `__getattribute__`, `__hash__`, `__new__`, `__reduce__`, `__reduce_ex__`, `__repr__`, `__setattr__`, `__str__`

Instance Variables | [hide private]
| proxy address of proxy server if one is required (http[s]://localhost[:8080])
bool | secure whether to use a secure http connection
| sessionId session id from smugmug.

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

Method Details | [hide private]

### __init__(self, sessionId=None, secure=True, proxy=None) (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: `SmugMugException` - if an error exists in the response

### _perform(self, c) | source code
Execute the request. A request pending execution. Parameters: `c` (PycURL `Curl`) - a pending request

### _prepare_keywords(self, **kwargs) | source code
Prepare the keywords for sending to SmugMug. The following steps are followed:
     1. If the key is C{method}, continue.
     2. If the key starts with an upper case letter, continue.
     3. If the key is in C{methods.apikeys}, replace the key.
     4. If the key ends with C{id}, upper case the first letter
        and C{ID} and replace the key.
     5. Else, upper case the first letter only and replace the
        key.
Parameters: `kwargs` - the keywords to send to SmugMug

### images_upload(self, **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

Property Details | [hide private]

### protocol Get Method: unreachable.protocol(self)