API: Class Collections¶
This class is used to interact with the Unsplash /collections REST API but also with lists of Collection objects
as returned by certain unsplash REST APIs.
The constructor can be invoked through the main PyUnsplash class as PyUnsplash.collections(type, page, per_page).
- The following class methods/properties in
PyUnsplashalso return aCollectionsclass object: - Collection.related()
- User.collections(page, per_page, order_by)
Methods and properties¶
Methods and properties exposed by the Collections class.
Collections.entries¶
Returns an iterator for the
Collectionobjects contained in thisCollectionsinstanceParameters
Argument Type Optional/Required Notes N/A Returns
iterator each time an instance of class CollectionExample
import pyunsplash pu = pyunsplash.PyUnsplash(api_key='<your Unsplash API key>') this_user = pu.user('salvoventura', w=100, h=100) collections = this_user.collections(page=1, per_page=5) for collection in collections.entries: print collection.id, collection.title