简体   繁体   English

适用于Appengine数据存储区的Google Contact的Python模型

[英]Python model of Google Contact for appengine datastore

I would like to save contacts on AppEngine datastore from the Google API v3 . 我想从Google API v3将联系人保存在AppEngine数据存储上 I want to know what is the best way to store these data and especially if there is already a model! 我想知道什么是存储这些数据的最佳方法,尤其是如果已经有一个模型!

Looking at the sources of gdata , I found a very interesting beginning. 查看gdata的来源 ,我发现了一个非常有趣的开始。 But this is the modeling of the data only in python and not for the datastore. 但这仅是在python中而不是数据存储中对数据进行建模。

Question : Is this model already exists in python? 问题:python中已经存在此模型吗?

If not: 如果不:

Question : What is the best way to start from scratch? 问题:从头开始的最佳方法是什么?

Beginning example of a contact in 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()

I think everyone is rolling their own. 我认为每个人都在自己滚动。 It is easy enough to do, you can take a look at AE-BaseApp/Python and check out the code from the Github link. 这很容易做到,您可以看一下AE-BaseApp / Python并从Github链接中签出代码。 I have some new code that will be updated in the near future that contains some improvements to the contact model. 我有一些新代码,将在不久的将来进行更新,其中包含对联系人模型的一些改进。 (the updated code is currently broken due to hacking to get logins working on both http and https here ) (更新后的代码正在打破由于黑客获得对登录HTTP和HTTPS工作在这里

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM