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
Feedback
I would be very pleased for a star :-)
Release files for aiopypexels 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| aiopypexels-1.0.1.tar.gz | 6.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| aiopypexels-1.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 14.8 kB
Release files / aiopypexels-1.0.1.tar.gz
| Download URL | aiopypexels-1.0.1.tar.gz |
|---|---|
| Size | 6.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ce8909beb1852f20075a4e97a19b30f20f0d43a26670ad6965291691fb7d2343
|
|
BLAKE2b-256 checksum How to use checksums |
b36f31dd9c55d6867bd49408ad4379e92ca587d4ad3dbffbab5a5d17f08c8c44
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.11
|
Release files / aiopypexels-1.0.1-py3-none-any.whl
| Download URL | aiopypexels-1.0.1-py3-none-any.whl |
|---|---|
| Size | 8.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4e064c2737b055a064f383d87826fed1dd27f75b44abd5fa7e895cdaf1be819a
|
|
BLAKE2b-256 checksum How to use checksums |
538c3e4aed5326905d78d98208c10693ab8abcd69896638134d78ce24abd18fb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.11
|