Skip to content

A library that provides a Python 3 interface for the Gravatar APIs

License

Notifications You must be signed in to change notification settings

pabluk/libgravatar

Folders and files

NameName
Last commit message
Last commit date

Latest commit

7852248 ยท Jul 24, 2023
Jul 24, 2023
Jul 24, 2023
Mar 6, 2023
Apr 9, 2021
Mar 13, 2013
Jul 24, 2023
Jun 10, 2020
Mar 10, 2013
Mar 5, 2023
Apr 4, 2018
Mar 6, 2023

Repository files navigation

libgravatar

A library that provides a Python 3 interface for the Gravatar API. API details: https://en.gravatar.com/site/implement/

Installation

Install via pip:

$ pip install libgravatar

Usage

See more details on https://libgravatar.readthedocs.org/

Gravatar API

Gravatar API requires no authentication to get images and profiles URLs.

Getting the user profile image:

from libgravatar import Gravatar
g = Gravatar('[email protected]')
g.get_image()
'https://www.gravatar.com/avatar/0bc83cb571cd1c50ba6f3e8a78ef1346'

Getting the profile URL:

from libgravatar import Gravatar
g = Gravatar('[email protected]')
g.get_profile()
'https://www.gravatar.com/0bc83cb571cd1c50ba6f3e8a78ef1346'

Gravatar XML-RPC API

The XML-RPC API requires authentication.

You can use your Gravatar.com's email and password:

from libgravatar import GravatarXMLRPC
g = GravatarXMLRPC('[email protected]', password='1234')
g.test() # test the API

or if you have an account at Wordpress.com you can use your email and API key. You can find your API key at https://apikey.wordpress.com/ just be sure to pass to the function your email instead of your username:

from libgravatar import GravatarXMLRPC
g = GravatarXMLRPC('[email protected]', apikey='1234')
g.test() # test the API

Development

To contribute to this project or to test this library locally you'll need to install these dependencies:

python3 -m venv venv # for example on a virtual environment
source venv/bin/activate
pip install pytest black

and you can validate your changes running:

pytest --doctest-modules --verbose
black . --check --diff

Author and contributors