使用 python 使用 google 共享联系人 api 插入联系人时的有效字段
尝试添加联系人 下面是来自api的示例代码 我在哪里可以获得所有有效字段(例如组织等)以及一些示例 python 代码?
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)
trying to add a contact
below is sample code from api
where can i get all the valid fields like organization etc and some sample python code for that?
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)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
gdata-python-client 源代码(请参阅PersonEntry 和 ContactEntry 类)和一些 使用客户端的示例代码。
There's a pretty full list of attributes in the gdata-python-client source code (see the PersonEntry and ContactEntry classes) and some example code for using the client as well.