GH avatar Bite 228. Create a Gravatar URL

In this Bite you will generate a Gravatar URL, e.g.

In this URL 5b13356d467af88631503c27a3d0e0cf is a hash of a lowercase and stripped email address.

Code create_gravatar_url hashing the passed in email arg. You can see a PHP example and you want to use hashlib + its md5 / hexdigest methods ...

Here is how the function works in the REPL. Note that spaces and case sensitivity won't matter: they produce the same hash and thus gravatar:

>>> from gravatar import create_gravatar_url
>>> create_gravatar_url("[email protected]")
>>> create_gravatar_url("[email protected]", 300)
>>> create_gravatar_url("[email protected] ", 300)
>>> create_gravatar_url("[email protected] ", 300)

(More information about the other parameters here)

Have fun and keep calm and code in Python!

Login and get coding
go back Intermediate level
Bitecoin 3X

53 out of 54 users completed this Bite.
Will you be Pythonista #54 to crack this Bite?
Resolution time: ~33 min. (avg. submissions of 5-240 min.)
Pythonistas rate this Bite 2.75 on a 1-10 difficulty scale.
» You can do it! 😌

We use Python 3.7