Skip to content
This repository has been archived by the owner on Aug 13, 2024. It is now read-only.
/ pypexels_l5 Public archive

An open source Python wrapper for the Pexels REST API - fork of https://github.com/salvoventura/pypexels

License

Notifications You must be signed in to change notification settings

Lumen5/pypexels_l5

Repository files navigation

⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️

This repository is no longer maintained

⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️

pypexels_l5

An open source Python wrapper for the Pexels REST API, supporting Python 2.7 and 3.6+. This is Lumen5's fork of salvoventura's work.

Note

When using this library you still need to abide by Pexels guidelines, which are explained on Pexels' API page

Examples

This example shows how the interaction with the paging functionality of the Pexels API is greatly abstracted and simplified. The code below will iterate through all popular images, and print attributes for each photo in there.

from pypexels import PyPexels
api_key = 'YOUR_API_KEY'

# instantiate PyPexels object
py_pexels = PyPexels(api_key=api_key)

popular_photos = py_pexels.popular(per_page=30)
while popular_photos.has_next:
    for photo in popular_photos.entries:
        print(photo.id, photo.photographer, photo.url)
    # no need to specify per_page: will take from original object
    popular_photos = popular_photos.get_next_page()

pypexels_l5 is released under the MIT License.