Look up information about photos and collections of photos from Flickr
Project description
flickr-photos-api
This is a library for getting information about photos from the Flickr API.
It's not a general-purpose Flickr API library. Instead, it focuses on providing information about photos and photo collections. It tries to abstract away some of the details of the Flickr API -- for example, licenses are returned as complete dictionaries, rather than as the numeric license IDs returned by Flickr API methods.
Examples:
>>> from flickr_photos_api import FlickrPhotosApi
>>> api = FlickrPhotosApi(api_key="…", user_agent="…")
>>> photo = api.get_single_photo(photo_id="14898030836")
>>> photo
{'id': '14898030836', 'title': 'NASA Scientists Says', …}
>>> photo["license"]
{'id': 'cc-by-2.0', 'label': 'CC BY 2.0', 'url': 'https://creativecommons.org/licenses/by/2.0/'}
>>> photo["url"]
'https://www.flickr.com/photos/lassennps/14898030836/'
This library was created for use in Flinumeratr, Flickypedia, and other Flickr Foundation projects.
Usage
-
Install flickr-photos-api from PyPI:
$ pip install flickr-photos-api
-
Construct an instance of
FlickrPhotosApi. You need to pass a user-agent that identifies you, and a Flickr API key.from flickr_photos_api import FlickrPhotosApi api = FlickrPhotosApi(api_key="…", user_agent="…")
-
Call methods on FlickrPhotosApi. The methods meant for public use are:
def get_single_photo(photo_id: str) -> SinglePhoto: ... def get_photos_in_album(user_url: str, album_id: str) -> PhotosInAlbum: ... def get_photos_in_gallery(gallery_id: str) -> PhotosInGallery: ... def get_public_photos_by_user(user_url: str) -> CollectionOfPhotos: ... def get_photos_in_group_pool(group_url: str) -> PhotosInGroup: ... def get_photos_with_tag(tag: str) -> CollectionOfPhotos: ...
Methods that return collections of photos also support
pageandper_pageparameters to control pagination.
Development
If you want to make changes to the library, there are instructions in CONTRIBUTING.md.
License
This project is dual-licensed as Apache-2.0 and MIT.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file flickr-photos-api-1.9.2.tar.gz.
File metadata
- Download URL: flickr-photos-api-1.9.2.tar.gz
- Upload date:
- Size: 25.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.12.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
760898ea14bdaccacace1d69bd5fa597495e4945b86253270a0d925d93c3bf89
|
|
| MD5 |
2be8c20a43e6c937fd8ef59744ad7b61
|
|
| BLAKE2b-256 |
38ac07447b6ae1d72699cff5c06fed59a01c0e90667034da3f730eacfbc3a77f
|
File details
Details for the file flickr_photos_api-1.9.2-py3-none-any.whl.
File metadata
- Download URL: flickr_photos_api-1.9.2-py3-none-any.whl
- Upload date:
- Size: 20.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.12.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f19cbbdc70eff84a1e50a9524f8d328e9fae384a6e876b63a747ac9ac9a94ce9
|
|
| MD5 |
6eacc5bce8ad681fd7f43fa4f24debdc
|
|
| BLAKE2b-256 |
0d58c247c735e482adaf68969a27083f8477fe7ea3c90edca9b3e3b19068d296
|