Skip to content

aruntom/pypexels

 
 

Repository files navigation

PyPexels

Latest Version Documentation Status Build Status Code Coverage Code Climate Code Health Say Thanks

An open source Python wrapper for the Pexels REST API. The source code is available on GitHub at https://github.com/salvoventura/pypexels.

Note

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

Installation

PyPexels is available on PyPI and thus can be installed with pip on most platforms.

$ pip install pypexels

Dependencies

This library depends on Requests to make - well - requests to the Pexels API. This additional package should be automatically installed at installation time, or you can simply install it by:

$ pip install requests

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()

Documentation

Documentation is published on ReadTheDocs.

Version

PyPexels v1.0.0b1 (beta, v1)

First release with wrappers around the two Pexels API for search and popular.

Note that using this library you still need to abide to Pexels Guidelines, which are explained on Pexels API page

License

PyPexels is released under the MIT License.

About

An open source Python wrapper for the Pexels REST API https://www.pexels.com/api/.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 100.0%