Skip to main content

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


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

Uploaded Source

Built Distribution

pexels_api-1.0.1-py3-none-any.whl (4.7 kB view details)

Uploaded Python 3

File details

Details for the file pexels-api-1.0.1.tar.gz.

File metadata

  • Download URL: pexels-api-1.0.1.tar.gz
  • Upload date:
  • Size: 3.1 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for pexels-api-1.0.1.tar.gz
Algorithm Hash digest
SHA256 89934dbe0e37481234c5659883be0958de0f809740b9874b9d2caaa974f9d0bf
MD5 5a588823d2786eaf0ad3ae7d8d73a839
BLAKE2b-256 c4764dbb76437cdf33607e220b1338ef27b2a883c0d431abccd72a4f5c62575a

See more details on using hashes here.

File details

Details for the file pexels_api-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: pexels_api-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 4.7 kB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for pexels_api-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3923eab214e6469a9b9fc6bc5a2d692e206a5c45f9f82b4ce1a685508057037e
MD5 e785b8fc48c3659d3186616b4df42f84
BLAKE2b-256 55ed46df816965f51e45d26197df4dc89c4f7d0b4ae4223ceb9ca4712f5a79e0

See more details on using hashes here.

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