# Class e.p.f.r.FlickrResourceProvider(ResourceProvider):

Part of elisa.plugins.flickr.resource_provider View In Hierarchy

A resource provider that implements the GET and POST methods for use on the Flickr API (see http://www.flickr.com/services/api/ for details). The GET method is also able to retrieve image files from Flickr directly.

Line # | Kind | Name | Docs
--- | --- | --- | ---
68 | Method | initialize | Initialize the component.
80 | Method | clean | Close all the open HTTP connections.
91 | Method | get | GET request to the Flickr servers.
326 | Method | post | POST request to the Flickr servers.

Inherited from ResourceProvider:

Line # | Kind | Name | Docs
--- | --- | --- | ---
107 | Method | put | Put one resource into another. Both resources are identified with URIs.
129 | Method | delete | Delete a Resource represented by a URI.

Inherited from Component (via ResourceProvider):

Line # | Kind | Name | Docs
--- | --- | --- | ---
85 | Class | PathDescriptor | Undocumented
97 | Class Method | create | Create and initialize the component.

Inherited from Loggable (via ResourceProvider, Component):

Line # | Kind | Name | Docs
--- | --- | --- | ---
81 | Method | __init__ | Undocumented

def initialize(self):
overrides elisa.core.component.Component.initialize

Initialize the component.

This method is called by `Component.create` to finish the initialization of a component.

Returns | a deferred called when a component is fully initialized (type: `twisted.internet.defer.Deferred` )

def clean(self):
overrides elisa.core.component.Component.clean
Close all the open HTTP connections.

def get(self, uri, context_model=None):
overrides elisa.core.components.resource_provider.ResourceProvider.get

    GET request to the Flickr servers.

    The request URI can be of one of the following forms:

        http://api.flickr.com/services/rest/?.*
        http://farm{farm_id}.static.flickr.com/.*\.jpg

    @param uri:           URI pointing to the resource
    @type uri:            L{elisa.core.media_uri.MediaUri}
    @param context_model: [not used]
    @type context_model:  C{None}

    @return:              a new model and a deferred fired when the model
                          is filled with the requested resource's data
    @rtype:               tuple of L{elisa.core.components.model.Model}
                          L{elisa.core.utils.defer.Deferred}

def post(self, uri, arguments, filename):
overrides elisa.core.components.resource_provider.ResourceProvider.post

    POST request to the Flickr servers.

    The request URI can be of one of the following forms:

        http://api.flickr.com/services/upload/
        http://api.flickr.com/services/replace/

    @param uri:       URI pointing to the resource
    @type uri:        L{elisa.core.media_uri.MediaUri}
    @param arguments: the arguments (including authentication and signing)
    @type arguments:  C{dict} of C{str}
    @param filename:  the name of a local photo file
    @type filename:   C{str}

    @return:          a deferred fired with the id of the photo
                      uploaded/replaced when the operation is complete
    @rtype:           L{elisa.core.utils.defer.Deferred}