Did I find the right examples for you? yes no

All Samples(332)  |  Call(0)  |  Derive(0)  |  Import(332)
Flickr API Acesss

General Doc: http://www.flickr.com/services/api/
Authentication Doc:  http://www.flickr.com/services/api/auth.spec.html

Sample usage:
        import Flickr.API

        # flickr.test.echo:
        api = Flickr.API.API(key, secret)
        test_rsp = api.execute_method(method='flickr.test.echo', sign=False)
        if test_rsp.code == 200:
                print test_rsp.read()

        # flickr.auth.getFrob:
        frob_request = Flickr.API.Request(method='flickr.auth.getFrob')
        frob_rsp = api.execute_request(frob_request)
        if frob_rsp.code == 200:
                frob_rsp_et = xml.etree.ElementTree.parse(frob_rsp)
                if frob_rsp_et.getroot().get('stat') == 'ok':
                        frob = frob_rsp_et.findtext('frob')
        
        # get the desktop authentication url
        auth_url = api.get_authurl('write', frob=frob)

        # ask the user to authorize your app now using that url
        print "auth me:  %s" % (auth_url,)
        input = raw_input("done [y]: ")
        if input.lower() not in ('', 'y', 'yes'):
                sys.exit()

        # flickr.auth.getToken:
        token_rsp = api.execute_request(Flickr.API.Request(method='flickr.auth.getToken', frob=frob, format='json', nojsoncallback=1))
        if token_rsp.code == 200:
                token_rsp_json = simplejson.load(token_rsp)
                if token_rsp_json['stat'] == 'ok':
                        token = str(token_rsp_json['auth']['token']['_content'])

        # flickr.activity.userPhotos (requires authentication):
        activity_rsp = api.execute_request(Flickr.API.Request(method='flickr.activity.userPhotos', auth_token=token, timeframe='1d', format='rest'))
        if activity_rsp.code == 200:
                activity_rsp_et = xml.etree.ElementTree.parse(activity_rsp)
                if activity_rsp_et.getroot().get('stat') == 'ok':
                        # do something with the activity
                        xml.etree.ElementTree.dump(activity_rsp_et)

        # upload
        photo = open('photo.jpg', 'rb')
        upload_request = Flickr.API.Request("http://api.flickr.com/services/upload", auth_token=token, title='test upload', photo=photo)
        upload_response = api.execute_request(upload_request, sign=True, encode=Flickr.API.encode_multipart_formdata)

        # or upload this way
        upload_response = api.execute_upload(filename='photo.jpg', args={'auth_token':token, 'title':'test upload', 'photo':photo})

src/v/d/vdsm-HEAD/vdsm_api/Bridge.py   vdsm(Download)
import logging
import types
import API
import yajsonrpc
try:
            apiObj = getattr(gapi, className)
        else:
            apiObj = getattr(API, className)
 
        ctorArgs = self._getArgs(argObj, apiObj.ctorArgs)

src/v/d/vdsm-HEAD/vdsm/network/api.py   vdsm(Download)
def _parseKwargs(args):
    import API
 
    kwargs = dict(arg.split('=', 1) for arg in args)
    API.Global.translateNetOptionsToNew(kwargs)

src/g/a/gae-flickrapp-HEAD/FlickrApp/ext/Flickr/API.py   gae-flickrapp(Download)
import mimetypes,urllib,urllib2
import warnings
import API
 
import google.appengine.api.urlfetch as urlfetch

src/g/a/gae-flickr-backup-HEAD/FlickrApp/ext/Flickr/API.py   gae-flickr-backup(Download)
import mimetypes,urllib,urllib2
import warnings
import API
 
def encode_multipart_formdata(args):

src/v/d/vdsm-HEAD/vdsm/BindingXMLRPC.py   vdsm(Download)
from vdsm.define import doneCode, errCode
from vdsm.netinfo import getDeviceByIP
import API
from vdsm.exception import VdsmException
try:

src/m/o/mom-HEAD/mom/HypervisorInterfaces/vdsmInterface.py   mom(Download)
import sys
sys.path.append('/usr/share/vdsm')
import API
import supervdsm
import logging

src/f/l/Flickr.API-0.4.4/Flickr/API.py   Flickr.API(Download)
import mimetypes,urllib,urllib2
import warnings
import API
 
def encode_multipart_formdata(args):