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

Class SmugBase

source code

object --+
         |
        SmugBase
Known Subclasses:

Abstract functionality for SmugMug API clients.

Instance Methods [hide private]
 
__init__(self, sessionId=None, secure=True, proxy=None, version='1.2.2', verbose=None, progress=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
 
batch(self)
Return an instance of a batch-oriented SmugMug client.
source code
 
images_upload(*args, **kwargs)
Upload the corresponding image.
source code

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

Instance Variables [hide private]
function progress
a function callback which takes four arguments: download_total, download_done, upload_total and upload_done.
url proxy
address of proxy server if one is required (http[s]://localhost[:8080])
bool secure
whether to use a secure http connection
string sessionId
session id from smugmug.
function verbose
a function callback which takes two arguments: infotype and message.
string version
which version of the SmugMug API to use
Properties [hide private]
  protocol

Inherited from object: __class__

Method Details [hide private]

__init__(self, sessionId=None, secure=True, proxy=None, version='1.2.2', verbose=None, progress=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.

This method also sets the appropriate PycURL options for verbose, progress, proxy and secure instance variables.

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:

_perform(self, c)

source code 

Execute the request.

A request pending execution.

Parameters:
  • c (PycURL Curl) - a pending request

images_upload(*args, **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
Decorators:
  • @smugmug_keywords

Property Details [hide private]

protocol

Get Method:
unreachable.protocol(self)