Skip to main content

An asynchronous wrapper for Pexels API based on aiohttp, which additionally allows to download photos in any of avaliable resolutions.

Project description

An asynchronous wrapper for Pexels API based on aiohttp, which additionally allows to download photos in any of avaliable resolutions.

Installation

Install aiopypexels with pip

  pip install aiopypexels

Examples

Searching photos by query

from aiopypexels import AioPexels
from aiopypexels.types import PhotoSearchResponse

api = AioPexels(API_KEY)

async def get_photos_by_query(query: str) -> PhotoSearchResponse:
    response = await api.get_photos_by_query(query)
    print(response.total_results)  # 498

Getting photo by ID

from aiopypexels import AioPexels
from aiopypexels.types import Photo

api = AioPexels(API_KEY)

async def get_photo_by_id(id: int) -> Photo:
    photo = await api.get_photo_by_id(id)

Downloading photo by ID

from aiopypexels import AioPexels

api = AioPexels(API_KEY)

async def download_photo_by_id(query: str) -> PhotoSearchResponse:
    response = await api.download_photo_by_id(photo_id=9999, destination = './photos/test.jpeg', quality='original')

Links

Latest Version

Feedback

I would be very pleased for a star :-)

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

aiopypexels-1.0.1.tar.gz (6.6 kB view details)

Uploaded Source

Built Distribution

aiopypexels-1.0.1-py3-none-any.whl (8.2 kB view details)

Uploaded Python 3

File details

Details for the file aiopypexels-1.0.1.tar.gz.

File metadata

  • Download URL: aiopypexels-1.0.1.tar.gz
  • Upload date:
  • Size: 6.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.11

File hashes

Hashes for aiopypexels-1.0.1.tar.gz
Algorithm Hash digest
SHA256 ce8909beb1852f20075a4e97a19b30f20f0d43a26670ad6965291691fb7d2343
MD5 4542dc10b6d7cb52183516b9f76adf51
BLAKE2b-256 b36f31dd9c55d6867bd49408ad4379e92ca587d4ad3dbffbab5a5d17f08c8c44

See more details on using hashes here.

File details

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

File metadata

  • Download URL: aiopypexels-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 8.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.11

File hashes

Hashes for aiopypexels-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4e064c2737b055a064f383d87826fed1dd27f75b44abd5fa7e895cdaf1be819a
MD5 545011e59c3842a712009f756a5c5a6d
BLAKE2b-256 538c3e4aed5326905d78d98208c10693ab8abcd69896638134d78ce24abd18fb

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