pexels api python

Solutions on MaxInterview for pexels api python by the best coders in the world

showing results for - "pexels api python"
Reid
22 Jul 2018
1# Import API class from pexels_api package
2from pexels_api import API
3# Type your Pexels API
4PEXELS_API_KEY = 'YOUR-PEXELS-API-KEY'
5# Create API object
6api = API(PEXELS_API_KEY)
7# Search five 'kitten' photos
8api.search('kitten', page=1, results_per_page=5)
9# Get photo entries
10photos = api.get_entries()
11# Loop the five photos
12for photo in photos:
13  # Print photographer
14  print('Photographer: ', photo.photographer)
15  # Print url
16  print('Photo url: ', photo.url)
17  # Print original size url
18  print('Photo original size: ', photo.original)
19