Jump to >

djblets.gravatars

get_gravatar_url_for_email(request=None, email=None, size=None)[source]

Return the Gravatar URL for an e-mail address.

The returned URL will always use HTTPS.

Note that callers adhering to the GDPR should check for a user’s consent before displaying a Gravatar on their behalf. This is checked automatically if using djblets.avatars.

Parameters:
  • request (django.http.HttpRequest) – Ignored. This argument will be removed in Djblets 2.0.
  • email (unicode) – The e-mail address to get the Gravatar URL for.
  • size (int, optional) – An optional height and width of the image (in pixels).
Returns:

The URL for the Gravatar associated with the given e-mail address.

Return type:

unicode

get_gravatar_url(request=None, user=None, size=None)[source]

Return the Gravatar URL for a user.

The returned URL will always use HTTPS.

Note that callers adhering to the GDPR should check for a user’s consent before displaying a Gravatar on their behalf. This is checked automatically if using djblets.avatars.

Parameters:
Returns:

The URL for the user’s Gravatar.

Return type:

unicode

Raises:

ValueError – Raised if user is None.