Line # | Kind | Name | Docs |
---|---|---|---|
45 | Function | sign_arguments | Compute the 'api_sig' argument for methods that need signing (see |
98 | Function | get_cached_token | Return the authentication token that has been locally cached. |
115 | Function | generate_call_uri | Generate the URI to use for a Flickr API call using an HTTP GET method. |
158 | Function | authenticate_1 | First step of the authentication to the Flickr API: request a Frob (see |
199 | Function | authenticate_2 | Second step of the authentication to the Flickr API: return the auth token |
224 | Function | build_photo_url | Build the real URL corresponding to a photo model. |
Compute the 'api_sig' argument for methods that need signing (see http://www.flickr.com/services/api/auth.spec.html#signing for details).
This method updates the dictionary of arguments passed as a parameter, setting the value of the 'api_sig' argument.Parameters | arguments | the arguments passed to the method that need signing
(type: dict of {str}
) |
Returns | the authentication token
(type: str
) | |
Raises | IOError | if the token cache file cannot be found |
Generate the URI to use for a Flickr API call using an HTTP GET method.
The 'method' and 'api_key' arguments are automatically added if not present. If authentication is required, the 'auth_token' argument will be automatically added. If signing is required, the signature will be computed and the 'api_sig' argument added.Parameters | base_uri | the base URI of the request
(type: str
) |
method | the Flickr API method name
(type: str
) | |
arguments | the arguments (key-value) of the method
(type: dict of str
) | |
authenticated | whether the method requires authentication
(type: bool
) | |
sign | whether the method requires signing
(type: bool
) | |
Returns | the complete URI of the request to send
(type: str
) |
First step of the authentication to the Flickr API: request a Frob (see http://www.flickr.com/services/api/flickr.auth.getFrob.html for details) and generate a login URL that the application should open in a browser window to let the user allow Elisa to access his content. Once the user has allowed the application to access his account, call the authenticate_2 method with the generated frob to get an authentication token.
If the application is already authenticated (authentication token locally cached), return the token. No subsequent call to authenticate_2 is needed.Parameters | provider | the Flickr resource provider
(type: elisa.plugins.flickr.resource_provider.FlickrResourceProvider
) |
Returns | a deferred that when fired returns a dictionary containing either the
login URL and the frob, or the token if already authenticated.
(type: twisted.internet.defer.Deferred
) |
Parameters | provider | the Flickr resource provider
(type: elisa.plugins.flickr.resource_provider.FlickrResourceProvider
) |
frob | the frob
(type: str
) | |
Returns | the authentication token if existing, None otherwise
(type: str
) |
Build the real URL corresponding to a photo model.
See http://www.flickr.com/services/api/misc.urls.html for details on how to build the URL of a photo. Once built this URL is cached in the model itself for faster subsequent accesses.Parameters | model | a photo model
(type: elisa.plugins.flickr.models.FlickrPhotoModel
) |