{"id":17197143,"url":"https://github.com/michaelhelmick/python-flickr","last_synced_at":"2025-09-07T20:06:13.890Z","repository":{"id":2232044,"uuid":"3185307","full_name":"michaelhelmick/python-flickr","owner":"michaelhelmick","description":"A Python Library to interface with Flickr REST API, OAuth \u0026 JSON Responses","archived":false,"fork":false,"pushed_at":"2017-01-04T12:43:14.000Z","size":18,"stargazers_count":39,"open_issues_count":2,"forks_count":14,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-05-14T18:56:33.749Z","etag":null,"topics":["api","flickr","flickr-api","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/michaelhelmick.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-01-15T19:17:32.000Z","updated_at":"2023-01-31T06:02:17.000Z","dependencies_parsed_at":"2022-08-25T15:00:24.875Z","dependency_job_id":null,"html_url":"https://github.com/michaelhelmick/python-flickr","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/michaelhelmick/python-flickr","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaelhelmick%2Fpython-flickr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaelhelmick%2Fpython-flickr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaelhelmick%2Fpython-flickr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaelhelmick%2Fpython-flickr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/michaelhelmick","download_url":"https://codeload.github.com/michaelhelmick/python-flickr/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaelhelmick%2Fpython-flickr/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259418180,"owners_count":22854184,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","flickr","flickr-api","python"],"created_at":"2024-10-15T01:55:34.392Z","updated_at":"2025-06-12T07:07:36.521Z","avatar_url":"https://github.com/michaelhelmick.png","language":"Python","readme":"Python-Flickr\n=============\n\nPython-Flickr is A Python library to interface with `Flickr REST API \u003chttp://www.flickr.com/services/api/\u003e`_ \u0026 OAuth\n\nFeatures\n--------\n\n* Photo Uploading\n* Retrieve user information\n* Common Flickr methods\n   - Add/edit/delete comments\n   - Add/edit/delete notes\n   - And many more (very dynamic library)!!\n* All responses return as nice dicts\n\nInstallation\n------------\n\nInstalling Python-Flickr is simple: ::\n\n    $ pip install python-flickr\n\nUsage\n-----\n\nAuthorization URL\n~~~~~~~~~~~~~~~~~\n::\n\n    f = FlickrAPI(api_key='*your app key*',\n              api_secret='*your app secret*',\n              callback_url='http://www.example.com/callback/')\n\n    auth_props = f.get_authentication_tokens()\n    auth_url = auth_props['auth_url']\n\n    #Store this token in a session or something for later use in the next step.\n    oauth_token = auth_props['oauth_token']\n    oauth_token_secret = auth_props['oauth_token_secret']\n\n    print 'Connect with Flickr via: %s' % auth_url\n\nOnce 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\nHandling the Callback\n~~~~~~~~~~~~~~~~~~~~~\n::\n\n    # oauth_token and oauth_token_secret come from the previous step\n    # if needed, store those in a session variable or something\n\n    f = FlickrAPI(api_key='*your app key*',\n                  api_secret='*your app secret*',\n                  oauth_token=oauth_token,\n                  oauth_token_secret=oauth_token_secret)\n\n    authorized_tokens = f.get_auth_tokens(oauth_verifier)\n\n    final_oauth_token = authorized_tokens['oauth_token']\n    final_oauth_token_secret = authorized_tokens['oauth_token_secret']\n\n    # Save those tokens to the database for a later use?\n\n\nGetting the Users recent activity feed\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n::\n\n    # Get the final tokens from the database or wherever you have them stored\n\n    f = FlickrAPI(api_key='*your app key*',\n                  api_secret='*your app secret*',\n                  oauth_token=final_tokens['oauth_token'],\n                  oauth_token_secret=final_tokens['oauth_token_secret'])\n\n    recent_activity = f.get('flickr.activity.userComments')\n    print recent_activity\n\n\nAdd comment on a photo\n~~~~~~~~~~~~~~~~~~~~~~\n::\n\n    # Assume you are using the FlickrAPI instance from the previous section\n\n    add_comment = f.post('flickr.photos.comments.addComment',\n                         params={'photo_id': '6620847285', 'comment_text': 'This is a test comment.'})\n\n    #This returns the comment id if successful.\n    print add_comment\n\n\nRemove comment on a photo\n~~~~~~~~~~~~~~~~~~~~~~~~~\n::\n\n    # Assume you are using the FlickrAPI instance from the previous section\n    # If the comment is already deleted, it will throw a FlickrAPIError (In this case, with code 2: Comment not found.)\n\n    del_comment = f.post('flickr.photos.comments.deleteComment', params={'comment_id':'45887890-6620847285-72157628767110559'})\n    print del_comment\n\n\nUpload a photo\n~~~~~~~~~~~~~~\n::\n\n    # Assume you are using the FlickrAPI instance from the previous section\n\n    files = open('/path/to/file/image.jpg', 'rb')\n    add_photo = f.post(params={'title':'Test Title!'}, files=files)\n\n    print add_photo  # Returns the photo id of the newly added photo\n\n\nCatching errors\n~~~~~~~~~~~~~~~\n::\n\n    # Assume you are using the FlickrAPI instance from the previous section\n\n    try:\n        # This comment was already deleted\n        del_comment = f.post('flickr.photos.comments.deleteComment', params={'comment_id':'45887890-6620847285-72157628767110559'})\n    except FlickrAPIError, e:\n        print e.msg\n        print e.code\n        print 'Something bad happened :('\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmichaelhelmick%2Fpython-flickr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmichaelhelmick%2Fpython-flickr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmichaelhelmick%2Fpython-flickr/lists"}