Skip to main content

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)

Release files for pexels-api 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pexels-api 1.0.1
File Size Uploaded
pexels-api-1.0.1.tar.gz 3.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pexels-api 1.0.1
File Interpreter ABI Platform
pexels_api-1.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 7.8 kB

Release files / pexels-api-1.0.1.tar.gz

Download URL pexels-api-1.0.1.tar.gz
Size 3.1 kB
Tags Source
SHA-256 checksum
How to use checksums
89934dbe0e37481234c5659883be0958de0f809740b9874b9d2caaa974f9d0bf
BLAKE2b-256 checksum
How to use checksums
c4764dbb76437cdf33607e220b1338ef27b2a883c0d431abccd72a4f5c62575a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.18.4 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.6.8

Release files / pexels_api-1.0.1-py3-none-any.whl

Download URL pexels_api-1.0.1-py3-none-any.whl
Size 4.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3923eab214e6469a9b9fc6bc5a2d692e206a5c45f9f82b4ce1a685508057037e
BLAKE2b-256 checksum
How to use checksums
55ed46df816965f51e45d26197df4dc89c4f7d0b4ae4223ceb9ca4712f5a79e0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.18.4 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.6.8

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page