Skip to main content

A wrapper that allows easy interaction with the Pexels API for everyone

Project description

GetFromPexels

GetFromPexels is an elegant Pexels API wrapper that is available for everyone to use with the Python programming language.

Examples

Finding images

# Finding 3 images of cats
from getfrompexels import PexelsSession
session = PexelsSession(API_KEY)
query = session.search_for_photos("cat", per_page=3)

for photo in query.contents:
    print(photo.pexels_url)

Finding videos

# Searching for dogs barking
from getfrompexels import PexelsSession
session = PexelsSession(API_KEY)

# Turning to page 2
query = session.search_for_videos("dog barking", page=2, per_page=3)

for video in query.contents:
    print(video.pexels_url)

Saving to files

# Downloading the first image that pops up when you search "bird"
from getfrompexels import PexelsSession
session = PexelsSession(API_KEY)

# Searching for the first result for "bird"
results = session.search_for_photos("bird", per_page=1).contents
photo = results[0]

# Downloading the photo
photo.download(PATH, "large2x")  # Several sizes accepted

Documentation

All classes and functions contain docstrings using the reST format as code documentation.

Additional Information

The library requires for the requests module to be installed.
If it isn't, running pip install requests in the terminal should install the library.

The earliest Python version that can use this library is Python 3.11.

To request an API key, you must make a Pexels account and get one from the official Pexels website.
The official documentation for the Pexels APi is https://www.pexels.com/api/documentation/, which contains information about endpoints and their results. GetFromPexels' main purpose is to provide anyone access to all the endpoints and provide an easy wrapper.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

getfrompexels-1.1.0.tar.gz (14.8 kB view hashes)

Uploaded Source

Built Distribution

getfrompexels-1.1.0-py3-none-any.whl (19.2 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page