Skip to content

Instantly share code, notes, and snippets.

@k1000
Created August 17, 2011 13:26
Show Gist options
  • Save k1000/1151523 to your computer and use it in GitHub Desktop.
Save k1000/1151523 to your computer and use it in GitHub Desktop.
get gravatar
#http://blog.gravatar.com/2008/01/17/gravatars-in-python-25/
import urllib, hashlib
# Set your variables here
email = "Someone@somewhere.com"
default = "http://www.somewhere.com/homsar.jpg"
size = 40
def get_gravatar(email):
gravatar_url = "http://www.gravatar.com/avatar.php?"
return gravatar_url += urllib.urlencode({'gravatar_id':hashlib.md5(email.lower()).hexdigest(), 'default':default, 'size':str(size)})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment