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-1.0.0.tar.gz (6.6 kB view details)

Uploaded Source

Built Distribution

aiopypexels-1.0.0-py3-none-any.whl (8.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: aiopypexels-1.0.0.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.0.tar.gz
Algorithm Hash digest
SHA256 5deff9ca6911b008a55ee22de40e710d561fa5aa6ac74ee812ca96e32f745441
MD5 a1b441acd0320837f4eb673777658811
BLAKE2b-256 5da56d1df035aff0d277a6e3452b40ab6f0e49dec129d7c7ac5e27d7e7c5050d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: aiopypexels-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 8.1 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1407dc862a90adbf79b98404496fd6bd8f4c45ecf74599df034e373a97ede135
MD5 7889a53cd7362350f8c2def2ac071a8f
BLAKE2b-256 0c7ec0a21a76dfd3e27952da12f92e73478e7d6564ad365feaeca1beffb63de3

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