Advertisement
opexxx

gravatr.py

Nov 25th, 2013
198
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.38 KB | None | 0 0
  1. # import code for encoding urls and generating md5 hashes
  2. import urllib, hashlib
  3.  
  4. # Set your variables here
  5. email = "someone@somewhere.com"
  6. default = "http://www.example.com/default.jpg"
  7. size = 40
  8.  
  9. # construct the url
  10. gravatar_url = "http://www.gravatar.com/avatar/" + hashlib.md5(email.lower()).hexdigest() + "?"
  11. gravatar_url += urllib.urlencode({'d':default, 's':str(size)})
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement