Skip to main content

A libravatar client for Python thats built on modern Technology

Pepy.tech Badge PyPi Version Badge PyPI - Python Version PyPI - License Code Style Lines of Code

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 ( and functionality ) 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 submit a Pull Request

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. You can also customize _alt text ) :

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. 😛

Updates :

The library is feature complete ( in my opinion ).

Metadata

Release files for libravatar-py 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for libravatar-py 1.0.1
File Size Uploaded
libravatar_py-1.0.1.tar.gz 4.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for libravatar-py 1.0.1
File Interpreter ABI Platform
libravatar_py-1.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 11.5 kB

Release files / libravatar_py-1.0.1.tar.gz

Download URL libravatar_py-1.0.1.tar.gz
Size 4.9 kB
Tags Source
SHA-256 checksum
How to use checksums
a7ecb9f2cb2cab4487bed2c0a0974a9da2e2db85e37fa1d5d6d844ea7f86bb1f
BLAKE2b-256 checksum
How to use checksums
648b857d4ac9a91242b695190959735f85c19709905bf386dc7f22df8da3ddc3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.6.1 CPython/3.12.0 Windows/11

Release files / libravatar_py-1.0.1-py3-none-any.whl

Download URL libravatar_py-1.0.1-py3-none-any.whl
Size 6.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b2339bbeac680abd356b647288615ae47d6907c3f66d0075218a3a802806ef23
BLAKE2b-256 checksum
How to use checksums
8fce48e35c13e89cfb23323cc2b6aa44ff62c29e6a3a7a1a5a610263a108a35f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.6.1 CPython/3.12.0 Windows/11

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files

1.0.0

1 release file

0.1.0

2 release files

0.0.2

1 release file

0.0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page