def has_gravatar(email):
 if (frappe.flags.in_import or frappe.flags.in_install or frappe.flags.in_test):
  return u''
 hexdigest = md5.md5(frappe.as_unicode(email).encode(u'utf-8')).hexdigest()
 gravatar_url = u'https://secure.gravatar.com/avatar/{hash}?d=404&s=200'.format(hash=hexdigest)
 try:
  res = requests.get(gravatar_url)
  if (res.status_code == 200):
   return gravatar_url
  else:
   return u''
 except requests.exceptions.ConnectionError:
  return u''

def has_gravatar ( email ) : if ( frappe . flags . in_import or frappe . flags . in_install or frappe . flags . in_test ) : return u'' hexdigest = md5 . md5 ( frappe . as_unicode ( email ) . encode ( u'utf-8' ) ) . hexdigest ( ) gravatar_url = u'https://secure.gravatar.com/avatar/{hash}?d=404&s=200' . format ( hash = hexdigest ) try : res = requests . get ( gravatar_url ) if ( res . status_code == 200 ) : return gravatar_url else : return u'' except requests . exceptions . ConnectionError : return u''
returns gravatar url if user has set an avatar at gravatar .