types module#

class Pexels.types.Collection(id: str, title: str, description: str, private: bool, media_count: int, photos_count: int, videos_count: int, **kwargs)#

Bases: PexelsType

description: str#

The description of the collection.

id: str#

The id of the collection.

media_count: int#

The total number of media included in this collection.

photos_count: int#

The total number of photos included in this collection.

private: bool#

Whether or not the collection is marked as private.

title: str#

The name of the collection.

videos_count: int#

The total number of videos included in this collection.

class Pexels.types.CollectionMediaResponse(id: str, media: List[Union[Photo, Video]], page: int, per_page: int, total_results: int, prev_page: Optional[str] = '', next_page: Optional[str] = '', **kwargs)#

Bases: PexelsType

id: str#

The id of the collection you are requesting.

media: List[Union[Photo, Video]]#

A list of media objects. Each object has an extra type attribute to indicate the type of object.

next_page: Optional[str]#

URL for the next page of results, if applicable.

page: int#

The current page number.

per_page: int#

The number of results returned with each page.

prev_page: Optional[str]#

URL for the previous page of results, if applicable.

total_results: int#

The total number of results for the request.

class Pexels.types.CollectionResponse(collections: List[Collection], page: int, per_page: int, total_results: int, prev_page: Optional[str] = '', next_page: Optional[str] = '', **kwargs)#

Bases: PexelsType

collections: List[Collection]#

A list of collection objects.

next_page: Optional[str]#

URL for the next page of results, if applicable.

page: int#

The current page number.

per_page: int#

The number of results returned with each page.

prev_page: Optional[str]#

URL for the previous page of results, if applicable

total_results: int#

The total number of results for the request.

class Pexels.types.PexelsType#

Bases: object

Base class for all pexels objects

class Pexels.types.Photo(id: int, width: int, height: int, url: str, photographer: str, photographer_url: str, photographer_id: int, avg_color: str, src: Src, alt: str, type: str = 'Photo', **kwargs)#

Bases: PexelsType

alt: str#

Text description of the photo for use in the alt attribute.

avg_color: str#

The average color of the photo. Useful for a placeholder while the image loads

height: int#

The real height of the photo in pixels.

id: int#

The id of the photo.

photographer: str#

The name of the photographer who took the photo.

photographer_id: str#

The id of the photographer.

photographer_url: str#

The URL of the photographer’s Pexels profile.

src: Src#

An assortment of different image sizes that can be used to display this Photo.

type: str#

The type of media to be shown in collections.

url: str#

The Pexels URL where the photo is located.

width: int#

The real width of the photo in pixels.

class Pexels.types.PhotoResponse(photos: List[Photo], page: int, per_page: int, total_results: int, prev_page: str = '', next_page: str = '', **kwargs)#

Bases: PexelsType

next_page#

URL for the next page of results, if applicable

alias of str

page#

The current page number

alias of int

per_page#

The number of results returned with each page

alias of int

photos#

A list of Photo object

alias of List[Photo]

prev_page#

URL for the previous page of results, if applicable

alias of str

total_results#

The total number of results for the request

alias of int

class Pexels.types.Src(original: str, large: str, large2x: str, medium: str, small: str, portrait: str, landscape: str, tiny: str, **kwargs)#

Bases: PexelsType

landscape: str#

The image cropped to W 1200px X H 627px.

large: str#

The image resized to W 940px X H 650px DPR 1.

large2x: str#

The image resized W 940px X H 650px DPR 2.

medium: str#

The image resized W 940px X H 650px DPR 2.

original: str#

The image without any size changes. It will be the same as the width and height attributes.

portrait: str#

The image cropped to W 800px X H 1200px.

small: str#

The image scaled proportionally so that it’s new height is 130px.

tiny: str#

The image cropped to W 280px X H 200px.

class Pexels.types.User(id: int, name: str, url: str, **kwargs)#

Bases: PexelsType

id: int#

The id of the videographer.

name: str#

The name of the videographer.

url: str#

The URL of the videographer’s Pexels Profile.

class Pexels.types.Video(id: int, width: int, height: int, url: str, image: str, duration: int, user: User, video_files: List[VideoFiles], video_pictures: List[VideoPicture], type: str = 'Video', **kwargs)#

Bases: object

duration: int#

The duration of the video in seconds.

height: int#

The real height of the video in pixels.

id: int#

The id of the video.

image: str#

URL to a screenshot of the video.

type: str#

The type of this media to be shown collections.

url: str#

The pexels URL where the video is located.

user: User#

The videographer who shot the video.

video_files: List[VideoFiles]#

A list of different sized versions of the video.

video_pictures: List[VideoPicture]#

A list of preview pictures of the video.

width: int#

The real width of the video in pixels.

class Pexels.types.VideoFiles(id: int, quality: str, file_type: str, width: int, height: int, link: str, **kwargs)#

Bases: PexelsType

file_type: str#

The video format of the video_file

height: int#

The height of the video_file in pixels.

id: int#

The id of the video_file

A link to where the video_file is hosted.

quality: str#

The video quality of the video_file

width: int#

The width of the video_file in pixels.

class Pexels.types.VideoPicture(id: int, picture: str, nr: int, **kwargs)#

Bases: PexelsType

id: int#

The id of the video_picture

nr: int#
picture: str#

A link to the preview image.

class Pexels.types.VideoResponse(videos: List[Video], url: str, page: int, per_page: int, total_results: int, prev_page: Optional[str] = '', next_page: Optional[str] = '', **kwargs)#

Bases: PexelsType

next_page: str#

URL for the next page of results, if applicable.

page: int#

The current page number.

per_page: int#

The number of results returned with each page.

prev_page: str#

URL for the previous page of results, if applicable.

total_results: int#

The total number of results for the request.

url: str#

The Pexels URL for the current search query.

videos: List[Video]#

A list of Video objects.