# `vcard` — vcard-temp support (XEP-0054)

This subpackage provides minimal support for setting and retrieving vCard as per XEP-0054.

New in version 0.10.

We supply the service:

class `aioxmpp.vcard.``VCardService`

  Service for handling vcard-temp.

  coroutine `get_vcard`(jid=None)

    Get the vCard stored for the jid jid. If jid is `None` get the vCard of the connected entity.

    Parameters: | jid – the object to retrieve.
    Returns: | the stored vCard.

    We mask a `XMPPCancelError` in case it is `feature-not-implemented` or `item-not-found` and return an empty vCard, since this can be understood to be semantically equivalent.

  coroutine `set_vcard`(vcard)

    Store the vCard vcard for the connected entity.

    Parameters: | vcard – the vCard to store.

    Note

    vcard should always be derived from the result of get_vcard to preserve the elements of the vcard the client does not modify.

    Warning

    It is in the responsibility of the user to supply valid vcard data as per XEP-0054.

The VCards are exposed as:

class `aioxmpp.vcard.xso.``VCard`

  The container for vCard data as per vcard-temp.

  `elements`

    The raw elements of the vCard (as etree).

  The following methods are defined to access and modify certain entries of the vCard in a highlevel manner:

  `get_photo_data`()

    Get the photo stored in the vCard.

    Returns: | the photo as `bytes` or `None`.

  `set_photo_data`(mime_type, data)

    Set the photo stored in the vCard.

    Parameters:

    - mime_type – the MIME type of the image data
    - data – the image data as `bytes`

  `clear_photo_data`()

    Remove the photo stored in the vCard.