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
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.1.tar.gz
(1.9 kB
view details)
Built Distribution
File details
Details for the file aiopypexels-0.0.1.tar.gz
.
File metadata
- Download URL: aiopypexels-0.0.1.tar.gz
- Upload date:
- Size: 1.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.11
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8c857fd6a2635a586b09e456a32309b65598cb6871ac4669a4013cc0ca6263f5 |
|
MD5 | d6c74adb81b8081461285f879ae29c6e |
|
BLAKE2b-256 | ec6718bc83cafe659498febe29c73afe9605b394517c5c2a5f08c22ed0110710 |
File details
Details for the file aiopypexels-0.0.1-py3-none-any.whl
.
File metadata
- Download URL: aiopypexels-0.0.1-py3-none-any.whl
- Upload date:
- Size: 1.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.11
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 82a36327f7e7fd4c661a93a7d415a5f814b9c82de60f5dd6bc3b9ee7c4df21ef |
|
MD5 | ed3811c71f01bafaef0f5484fe7ddf3c |
|
BLAKE2b-256 | 72b078245fa73b3a79d46abb8ba31b252a1dbe5971fb2de64f88bf29830ae37b |