A libravatar client for Python thats built on modern Technology
Project description
A libravatar client for Python thats built on modern Technology
Introduction :
Friendly fork of pyLibravatar.
Why did I write this library:
While working on the Libravatar client project I came across the well built pyLibravatar library. The last update was at Jun 28, 2015 ( Thats over 6 years ago when I was writing this ). So thats why I decided to write this library. It mimics the API of pyLibravatar but with asyncio spice.
Why use “libravatar-py” ?
Provides API for different kinds of usage.
Built with modern techknology.
No unnecessary codes. ( My goal was to keep the library as small as possible )
Is very minimal. ( Only provides 4 functions )
Fully Fedarated and feature rich.
Why shouldn’t you use “libravatar-py” ?
I donno ? If you do please do a pull request fixing this.
User guide :
Installation :
Install with pip from pypi (No extra dependencies):
$ python -m pip install libravatar-py
Install with pip from github ( Development | Not Recommended for Production ):
$ python -m pip install https://codeload.github.com/baseplate-admin/libravatar-py/zip/refs/heads/main
Usage:
Call any of these 4 methods.
libravatar_url function ( This will essentially return the base url of the image ) :
from libravatar import libravatar_url
url = libravatar_url(email="someone@example.com")
print(url)
# https://seccdn.libravatar.org/avatar/16d113840f999444259f73bac9ab8b10
libravatar_img_tag function ( This will wrap the libravatar url in a <img /> tag ) :
from libravatar import libravatar_img_tag
url = libravatar_img_tag(email="someone@example.com")
print(url)
# <img src=https://seccdn.libravatar.org/avatar/16d113840f999444259f73bac9ab8b10 alt='Avatar for someone@example.com' />
libravatar_raw_image function ( This will return the Libravatar image in a binary form ) :
from libravatar import libravatar_raw_image
res = libravatar_raw_image(email="someone@example.com")
print(res)
# Large binary string.
# To load it.
from PIL import Image
from io import BytesIO
res = Image.open(BytesIO(res))
libravatar_raw_query function ( Essentially passes the {args, kwargs} to httpx_get_avatar ):
from libravatar import libravatar_raw_image
# Note this this must be called from an async function
res = await libravatar_raw_query(email="someone@example.com", {})
# All httpx variables available in res
Contributing :
If you like this project add a star. If you have problems or suggestions please put them in the Issue Tracker. If you like to add features. Fork this repo and submit a Pull Request. 😛
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Hashes for libravatar_py-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f25ab14327866a01841afb84d6f9cbf7c09f85a7132b19526117e2eda8ca981a |
|
MD5 | 9ffdf4ae6c93cc8d9569631153e81dfa |
|
BLAKE2b-256 | 7b3edc3c13bb23ad267ed29b913777b2edf082b52d31669ce708a5b782a3e819 |