Softpedia
 


LINUX CATEGORIES:



GLOBAL PAGES >>
NEWS ARCHIVE >>
SOFTPEDIA REVIEWS >>
MEET THE EDITORS >>
WEEK'S BEST
  • Linux Kernel 3.9.3 / 3....
  • LibreOffice 3.6.6 / 4.0.3
  • MPlayer 1.1.1
  • systemd 204
  • Arch Linux 2013.05.01
  • Blender 2.67
  • KDE Software Compilatio...
  • CrunchBang Linux Stable...
  • Elementary OS 0.1 / 0.2...
  • SystemRescueCd 3.6.0
  • Home > Linux > Programming > Libraries

    python-flickr 0.3.0

    Download button

    No screenshots available
    Downloads: 135  Tell us about an update
    User Rating:
    Rated by:
    NOT RATED
    0 user(s)
    Developer:

    License / Price:

    Last Updated:

    Category:
    Mike Helmick | More programs
    MIT/X Consortium Lic... / FREE
    August 11th, 2012, 01:13 GMT
    ROOT / Programming / Libraries

     Read user reviews (0)  Refer to a friend  Subscribe

    python-flickr description

    A Python Library to interface with Flickr REST API & OAuth

    python-flickr is a Python library to interface with the Flickr REST API & OAuth.

    Authorization URL


    Get an authorization url for your user

    f = FlickrAPI(api_key='*your app key*',
     api_secret='*your app secret*',
     callback_url='http://www.example.com/callback/')

    auth_props = f.get_authentication_tokens()
    auth_url = auth_props['auth_url']

    #Store this token in a session or something for later use in the next step.
    oauth_token_secret = auth_props['oauth_token_secret']

    print 'Connect with Flickr via: %s' % auth_url


    Once you click "Allow" be sure that there is a URL set up to handle getting finalized tokens and possibly adding them to your database to use their information at a later date. \n\n'

    Handling the callback

    # In Django, you'd do something like
    # oauth_token = request.GET.get('oauth_verifier')
    # oauth_verifier = request.GET.get('oauth_verifier')

    oauth_token = *Grab oauth token from URL*
    oauth_verifier = *Grab oauth verifier from URL*

    #Initiate the FlickrAPI class in your callback.
    f = FlickrAPI(api_key='*your app key*',
     api_secret='*your app secret*',
     oauth_token=oauth_token,
     oauth_token_secret=session['flickr_session_keys']['oauth_token_secret'])

    authorized_tokens = f.get_auth_tokens(oauth_verifier)

    final_oauth_token = authorized_tokens['oauth_token']
    final_oauth_token_secret = authorized_tokens['oauth_token_secret']

    # Save those tokens to the database for a later use?


    Getting some user information & adding comments to photos.

    # Get the final tokens from the database or wherever you have them stored

    f = FlickrAPI(api_key = '*your app key*',
     api_secret = '*your app secret*',
     oauth_token=final_tokens['oauth_token'],
     oauth_token_secret=final_tokens['oauth_token_secret'])

    # Return the users recent activity feed.
    recent_activity = f.get('flickr.activity.userComments')
    print recent_activity

    # Add comment on a photo
    add_comment = f.post('flickr.photos.comments.addComment', params={'photo_id':'6620847285', 'comment_text':'This is a test comment.'})

    #This returns the comment id if successful.
    print add_comment

    # Remove comment on a photo
    # If the comment is already deleted, it will throw a FlickrAPIError (In this case, with code 2: Comment not found.)
    del_comment = f.post('flickr.photos.comments.deleteComment', params={'comment_id':'45887890-6620847285-72157628767110559'})
    print del_comment


    Uploading a Photo

    f = FlickrAPI(api_key = '*your app key*',
     api_secret = '*your app secret*',
     oauth_token=final_tokens['oauth_token'],
     oauth_token_secret=final_tokens['oauth_token_secret'])

    f.post(params={'title':'Test Title!'}, files='/path/to/image.jpg')



    Product's homepage

    Requirements:

    · Python

      


    TAGS:

    Flickr API | Flickr OAuth | Python library | Python | Flickr | API

    Go to top

    WindowsGamesDriversMacLinuxScriptsMobileHandheldNews

    SUBMIT PROGRAM   |   ADVERTISE   |   GET HELP   |   SEND US FEEDBACK   |   RSS FEEDS   |   UPDATE YOUR SOFTWARE   |   ROMANIAN FORUM