PyGravatar 0.0.1 documentation

gravatar.hash_email(email)[source]
Parameters:email (string) – email address
Returns:the hash of email, suitable for embedding in a URL to retrieve its assigned image, e.g., http://gravatar.com/avatar/<hash>
class gravatar.Rating[source]

Image rating.

Member Value
G 0
PG 1
R 2
X 3
class gravatar.Image[source]

Represents an image in a user account.

Variables:
  • id – unique ID used to refer to this image
  • url – unique URL to retrieve this image, even if it is unassigned
  • rating – rating for the image
class gravatar.User(email, password=None, apikey=None)[source]

Represents a user account.

At least one of password and apikey must be specified.

Parameters:
  • email (string) – an email address belonging to the account
  • password (string) – password for the account
  • apikey (string) – API key for your application
exists(*emails)[source]
Parameters:emails (vararg list of string) – email addresses to check
Returns:dictionary where each key is an email address from the passed-in list and each value is a boolean of whether that email address belongs to a Gravatar account and has an image assigned to it.
Return type:{string: boolean}
emails()[source]
Returns:dictionary where each key is an email address belonging to the user account and each value is the Image assigned to it, or None if no image is assigned
Return type:{string: Image}
images()[source]
Returns:images belonging to the user account
Return type:list of Image
saveData(data, rating)[source]

Save the data as a new image in the user account.

Parameters:
  • data (string) – binary image data to save
  • rating (int (see Rating)) – rating for the new image
Returns:

ID of new image

Return type:

string

saveUrl(url, rating)[source]

Read the image pointed to by the URL and save it as a new image in the user account.

Parameters:
  • url (string) – URL pointing to an image to save
  • rating (int (see Rating)) – rating for the new image
Returns:

ID of new image

Return type:

string

useImage(id, *emails)[source]

Assign the image identified by an ID to every email address passed in.

Parameters:
  • id (string) – ID of image to assign
  • emails (vararg list of string) – email addresses to assign the image to
removeImage(*emails)[source]

For every email address passed in, unassign its image.

Parameters:emails (vararg list of string) – email addresses to be unassigned
deleteImage(id)[source]

Delete the image from the user account, and unassign it from any email addresses.

Parameters:id (string) – ID of image to delete
test()[source]
Returns:the server’s number of seconds since the current epoch.
Return type:int

Indices and tables

Table Of Contents

This Page