[英]Python model of Google Contact for appengine datastore
我想從Google API v3將聯系人保存在AppEngine數據存儲上 。 我想知道什么是存儲這些數據的最佳方法,尤其是如果已經有一個模型!
查看gdata的來源 ,我發現了一個非常有趣的開始。 但這僅是在python中而不是數據存儲中對數據進行建模。
問題:python中已經存在此模型嗎?
如果不:
問題:從頭開始的最佳方法是什么?
Python中聯系人的開始示例:
class Contact(db.Model):
"""
https://developers.google.com/gdata/docs/2.0/elements?hl=fr#gdContactKind
https://developers.google.com/appengine/docs/python/datastore/datamodeling
"""
content = db.Text()
"""atom:content Notes about the contact."""
link = db.ListProperty(Link,indexed=False,default=[])
"""atom:link* Links to related information. Specifically, atom:link[@rel='alternate'] links to an HTML page describing the contact."""
title = db.StringProperty()
"""atom:title Contact's name. This field is read only. To modify the contact's name, see gd:name."""
email = db.ListProperty(Email,indexed=False,default=[])
"""gd:email* Email addresses."""
"""etc..."""
class Link(db.Model):
"""
Link
"""
link = db.LinkProperty()
class Email(db.Model):
"""
Email
"""
email_address = db.EmailProperty()
class EmailImParent(db.Model):
address = db.StringProperty()
label = db.StringProperty()
rel = db.StringProperty()
primary = db.StringProperty()
class Email(db.Model,EmailImParent):
"""
The gd:email element.
"""
email = db.EmailProperty()
display_name = db.StringProperty()
我認為每個人都在自己滾動。 這很容易做到,您可以看一下AE-BaseApp / Python並從Github鏈接中簽出代碼。 我有一些新代碼,將在不久的將來進行更新,其中包含對聯系人模型的一些改進。 (更新后的代碼正在打破由於黑客獲得對登錄HTTP和HTTPS工作在這里 )
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.