Support for gravatar in User
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import hashlib
|
||||
import urllib
|
||||
from .resource import List
|
||||
from .resource import Find
|
||||
from .resource import Create
|
||||
@@ -10,3 +12,10 @@ class User(List, Find, Create, Post, Update, Delete):
|
||||
"""User class wrapping the REST nodes endpoint
|
||||
"""
|
||||
path = "users"
|
||||
|
||||
def gravatar(self, size=64):
|
||||
"""Generate Gravatar link on the fly using the email value"""
|
||||
parameters = {'s':str(size), 'd':'mm'}
|
||||
return "https://www.gravatar.com/avatar/" + \
|
||||
hashlib.md5(self.email.lower()).hexdigest() + \
|
||||
"?" + urllib.urlencode(parameters)
|
||||
|
||||
Reference in New Issue
Block a user