Login and get codingIn this Bite you will generate a Gravatar URL, e.g. https://www.gravatar.com/avatar/5b13356d467af88631503c27a3d0e0cf?s=200&r=g&d=robohash.
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 usehashlib
+ itsmd5 / 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]") 'https://www.gravatar.com/avatar/5b13356d467af88631503c27a3d0e0cf?s=200&r=g&d=robohash' >>> create_gravatar_url("[email protected]", 300) 'https://www.gravatar.com/avatar/5b13356d467af88631503c27a3d0e0cf?s=300&r=g&d=robohash' >>> create_gravatar_url("[email protected] ", 300) 'https://www.gravatar.com/avatar/5b13356d467af88631503c27a3d0e0cf?s=300&r=g&d=robohash' >>> create_gravatar_url("[email protected] ", 300) 'https://www.gravatar.com/avatar/5b13356d467af88631503c27a3d0e0cf?s=300&r=g&d=robohash'(More information about the other parameters here)
Have fun and keep calm and code in Python!
91 out of 91 users completed this Bite.
Will you be Pythonista #92 to crack this Bite?
Resolution time: ~29 min. (avg. submissions of 5-240 min.)
Pythonistas rate this Bite 2.8 on a 1-10 difficulty scale.
» You can do it! 😌