Package pysmug
[hide private]
[frames] | no frames]

Package pysmug

source code

A high-performance client to the SmugMug API.

This client supports the entire set of methods available through smugmug both serially and in batch.

References:


Version: 0.4

Submodules [hide private]

Functions [hide private]
 
smugmug_keywords(fn)
Prepare the keywords for sending to SmugMug.
source code
 
login(conf=None, klass=None, proxy=None)
Login to smugmug using the contents of the configuration file.
source code
Function Details [hide private]

smugmug_keywords(fn)

source code 

Prepare the keywords for sending to SmugMug.

The following operations are performed:

 1. If the key is "method", continue.
 2. If the key starts with an upper case letter, continue.
 3. If the key is in {methods.apikeys}, replace the key.
 4. If the key ends with {id}, upper case the first letter
    and {ID} and replace the key.
 5. Else, upper case the first letter only and replace the
    key.
Parameters:
  • fn - the decorated function

login(conf=None, klass=None, proxy=None)

source code 

Login to smugmug using the contents of the configuration file.

If no configuration file is specified then a file named .pysmugrc in the user's home directory is used if it exists.

The format is a standard configuration parseable by ConfigParser. The main section pysmug is required. The key login references which section to use for authentication with SmugMug. The key smugmug is optional and can specify an alternate SmugMug class to instantiate. This is an example file:

 [pysmug]
 login=login_withHash
 smugmug=pysmug.SmugTool

 [login_withHash]
 APIKey = <my api key>
 userId = <my user id>
 passwordHash = <my password hash>

 [login_anonymously]
 APIKey = <my api key>
Parameters:
  • conf (string) - path to a configuration file
  • klass (SmugMug class) - class to instantiate
  • proxy - address of proxy server if one is required (http[s]://localhost[:8080])
Raises:
  • ValueError - if no configuration file is found