Skip to content

Instantly share code, notes, and snippets.

@yosida95
Created June 10, 2012 07:57
Show Gist options
  • Save yosida95/2904431 to your computer and use it in GitHub Desktop.
Save yosida95/2904431 to your computer and use it in GitHub Desktop.
def get_gravatar(mailaddress):
from urllib import urlencode
from hashlib import md5
from urlparse import urlunparse
_query_string = urlencode({
'd': DEFAULT_USER_ICON, 's': 160
})
call_api_addr = [
'http', 'www.gravatar.com',
'/avatar/%s' % (md5(mailaddress).hexdigest()), '', _query_string, ''
]
return urlunparse(call_api_addr)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment