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 PhotoSearchResponse

api = AioPexels(API_KEY)

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

Downloading photo by ID

from aiopypexels import AioPexels

api = AioPexels(API_KEY)

async def get_photo_by_query(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-0.0.2.tar.gz (6.6 kB view details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: aiopypexels-0.0.2.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-0.0.2.tar.gz
Algorithm Hash digest
SHA256 5de2cdade6d1606e96d630f475d570f5cd33335e7555e9b631bda21b76411cc8
MD5 927ed4fecbe28aba45e9dcf0766f70a6
BLAKE2b-256 968a1cf4130b9358c29644c765e49175d2040749e265c202ba3f6e7763e7c67f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: aiopypexels-0.0.2-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-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 7ff7227f51ebbb63eaeb4c71efd20e1a49af54380614f77efa050347f463385c
MD5 4e1c8f131553d21c0ca96d2a2fc457e8
BLAKE2b-256 2e6da6202a775bd88a07cd0adbb28bf05fc814b1c3a322e722d98f0aaa605149

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