Jump to >

djblets.gravatars

get_gravatar_url_for_email(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:
  • 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(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:
  • user (django.contrib.auth.models.User) – The user whose Gravatar URL is to be retrieved.
  • size (int, optional) – An optional height and width of the image (in pixels).
Returns:

The URL for the user’s Gravatar.

Return type:

unicode

Raises:

ValueError – Raised if user is None.