Use Pexels API v1 with Python
Project description
Using Pexels API v1 with Python
Use pexels_api to search photos from Pexels.
Dependencies:
Installation:
pip install pexels-api
Usage:
The following code shows you how to import the package and make a simple query to Pexels API v1. See more examples or the documentation.
# Import API class from pexels_api package
from pexels_api import API
# Type your Pexels API
PEXELS_API_KEY = 'YOUR-PEXELS-API-KEY'
# Create API object
api = API(PEXELS_API_KEY)
# Search five 'kitten' photos
api.search('kitten', page=1, results_per_page=5)
# Get photo entries
photos = api.get_entries()
# Loop the five photos
for photo in photos:
# Print photographer
print('Photographer: ', photo.photographer)
# Print url
print('Photo url: ', photo.url)
# Print original size url
print('Photo original size: ', photo.original)
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
pexels-api-1.0.1.tar.gz
(3.1 kB
view hashes)
Built Distribution
Close
Hashes for pexels_api-1.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3923eab214e6469a9b9fc6bc5a2d692e206a5c45f9f82b4ce1a685508057037e |
|
MD5 | e785b8fc48c3659d3186616b4df42f84 |
|
BLAKE2b-256 | 55ed46df816965f51e45d26197df4dc89c4f7d0b4ae4223ceb9ca4712f5a79e0 |