Home | Trees | Indices | Help |
|
---|
|
object --+ | FlickrAPI
Encapsulates Flickr functionality.
Example usage:
flickr = flickrapi.FlickrAPI(api_key) photos = flickr.photos_search(user_id='73509078@N00', per_page='10') sets = flickr.photosets_getList(user_id='73509078@N00')
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
generator, yields each photo in a single set |
|
||
generator, yields each photo in a search query result |
|
||
Inherited from |
|
|||
Inherited from |
|
Construct a new FlickrAPI instance for a given API key and secret.
|
|
|
|
|
|
Calculate the flickr signature for a set of params.
|
Handle all the regular Flickr API calls. Example: flickr.auth_getFrob(api_key="AAAAAA") etree = flickr.photos_getInfo(photo_id='1234') etree = flickr.photos_getInfo(photo_id='1234', format='etree') xmlnode = flickr.photos_getInfo(photo_id='1234', format='xmlnode') json = flickr.photos_getInfo(photo_id='1234', format='json') |
Returns a new dictionary containing args, augmented with defaults from defaults. Defaults can be overridden, or completely removed by setting the appropriate value in args to None. >>> f = FlickrAPI('123') >>> f._FlickrAPI__supply_defaults( ... {'foo': 'bar', 'baz': None, 'token': None}, ... {'baz': 'foobar', 'room': 'door'}) {'foo': 'bar', 'room': 'door'} |
Performs a Flickr API call with the given arguments. The method name itself should be passed as the 'method' parameter. Returns the unparsed data from Flickr: data = self.__flickr_call(method='flickr.photos.getInfo', photo_id='123', format='rest') |
Wraps a method call in a parser. The parser will be looked up by the parse_format specifier. If there is a parser and kwargs['format'] is set, it's set to rest, and the response of the method is parsed before it's returned. |
Return the authorization URL to get a token. This is the URL the app will launch a browser toward if it needs a new token.
|
Returns the web login URL to forward web users to.
|
Returns the response format given in kwargs['format'], or the default format if there is no such key. If kwargs contains 'format', it is removed from kwargs. If the format isn't compatible with Flickr's upload response type, a FlickrError exception is raised. |
Upload a file to flickr. Be extra careful you spell the parameters correctly, or you will get a rather cryptic "Invalid Signature" error on the upload! Supported parameters:
The callback method should take two parameters: def callback(progress, done) Progress is a number between 0 and 100, and done is a boolean that's true only when the upload is done. |
Replace an existing photo. Supported parameters:
The callback parameter has the same semantics as described in the upload function. |
Uploads a photo - can be used to either upload a new photo or replace an existing one. form_url must be either FlickrAPI.flickr_replace_form or FlickrAPI.flickr_upload_form. |
Sends a Multipart object to an URL. Returns the resulting unparsed XML from Flickr. |
Get a token either from the cache, or make a new one from the frob. This first attempts to find a token in the user's token cache on disk. If that token is present and valid, it is returned by the method. If that fails (or if the token is no longer valid based on flickr.auth.checkToken) a new frob is acquired. If an auth_callback method has been specified it will be called. Otherwise the frob is validated by having the user log into flickr (with a browser).
The newly minted token is then cached locally for the next run.
An example: (token, frob) = flickr.get_token_part_one(perms='write') if not token: raw_input("Press ENTER after you authorized this program") flickr.get_token_part_two((token, frob)) Also take a look at authenticate_console(perms). |
|
Performs the authentication, assuming a console program. Gets the token, if needed starts the browser and waits for the user to press ENTER before continuing. See get_token_part_one(...) for an explanation of the parameters. |
Calls 'method' with page=0, page=1 etc. until the total number of pages has been visited. Yields the photos returned. Assumes that method(page=n, **params).findall('*/photos') results in a list of photos, and that the toplevel element of the result contains a 'pages' attribute with the total number of pages.
|
Other arguments can be passed, as documented in the flickr.photosets.getPhotos API call in the Flickr API documentation, except for page because all pages will be returned eventually. Uses the ElementTree format, incompatible with other formats.
|
Accepts the same parameters as flickr.photos.search API call, except for page because all pages will be returned eventually. Also see walk_set.
|
Home | Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Sun Oct 26 15:20:18 2014 | http://epydoc.sourceforge.net |