2

以下に連絡先を追加しようとしているのは、 組織などのすべての有効なフィールドとそのためのいくつかのサンプルPythonコードを取得できるAPIのサンプルコードです。

new_contact = gdata.contacts.ContactEntry(title=atom.Title(text=name))
new_contact.content = atom.Content(text=notes)
# Create a work email address for the contact and use as primary.
new_contact.email.append(gdata.contacts.Email(address=primary_email,
    primary='true', rel=gdata.contacts.REL_WORK))
# Add extended properties to add data which is used in your application.
new_contact.extended_property.append(gdata.ExtendedProperty(
    name='favourite flower', value='daisy'))
sports_property = gdata.ExtendedProperty(name='sports')
sports_property.SetXmlBlob('<dance><salsa/><ballroom_dancing/></dance>')
new_contact.extended_property.append(sports_property)

# Send the contact data to the server.
contact_entry = gd_client.CreateContact(new_contact)
4

1 に答える 1

0

gdata-python-client ソース コード(PersonEntry クラスと ContactEntry クラスを参照)属性のかなり完全なリストと、クライアントを使用するためのサンプル コードもあります。

于 2011-05-17T18:43:58.070 に答える