/gdata/webmastertools/data.py

http://radioappz.googlecode.com/ · Python · 217 lines · 92 code · 76 blank · 49 comment · 0 complexity · 1ad04e89361e3e9f86706b56a1f062fc MD5 · raw file

  1. #!/usr/bin/python
  2. #
  3. # Copyright (C) 2009 Google Inc.
  4. #
  5. # Licensed under the Apache License, Version 2.0 (the "License");
  6. # you may not use this file except in compliance with the License.
  7. # You may obtain a copy of the License at
  8. #
  9. # http://www.apache.org/licenses/LICENSE-2.0
  10. #
  11. # Unless required by applicable law or agreed to in writing, software
  12. # distributed under the License is distributed on an "AS IS" BASIS,
  13. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. # See the License for the specific language governing permissions and
  15. # limitations under the License.
  16. """Contains the data classes of the Google Webmaster Tools Data API"""
  17. __author__ = 'j.s@google.com (Jeff Scudder)'
  18. import atom.core
  19. import atom.data
  20. import gdata.data
  21. import gdata.opensearch.data
  22. WT_TEMPLATE = '{http://schemas.google.com/webmaster/tools/2007/}%s'
  23. class CrawlIssueCrawlType(atom.core.XmlElement):
  24. """Type of crawl of the crawl issue"""
  25. _qname = WT_TEMPLATE % 'crawl-type'
  26. class CrawlIssueDateDetected(atom.core.XmlElement):
  27. """Detection date for the issue"""
  28. _qname = WT_TEMPLATE % 'date-detected'
  29. class CrawlIssueDetail(atom.core.XmlElement):
  30. """Detail of the crawl issue"""
  31. _qname = WT_TEMPLATE % 'detail'
  32. class CrawlIssueIssueType(atom.core.XmlElement):
  33. """Type of crawl issue"""
  34. _qname = WT_TEMPLATE % 'issue-type'
  35. class CrawlIssueLinkedFromUrl(atom.core.XmlElement):
  36. """Source URL that links to the issue URL"""
  37. _qname = WT_TEMPLATE % 'linked-from'
  38. class CrawlIssueUrl(atom.core.XmlElement):
  39. """URL affected by the crawl issue"""
  40. _qname = WT_TEMPLATE % 'url'
  41. class CrawlIssueEntry(gdata.data.GDEntry):
  42. """Describes a crawl issue entry"""
  43. date_detected = CrawlIssueDateDetected
  44. url = CrawlIssueUrl
  45. detail = CrawlIssueDetail
  46. issue_type = CrawlIssueIssueType
  47. crawl_type = CrawlIssueCrawlType
  48. linked_from = [CrawlIssueLinkedFromUrl]
  49. class CrawlIssuesFeed(gdata.data.GDFeed):
  50. """Feed of crawl issues for a particular site"""
  51. entry = [CrawlIssueEntry]
  52. class Indexed(atom.core.XmlElement):
  53. """Describes the indexing status of a site"""
  54. _qname = WT_TEMPLATE % 'indexed'
  55. class Keyword(atom.core.XmlElement):
  56. """A keyword in a site or in a link to a site"""
  57. _qname = WT_TEMPLATE % 'keyword'
  58. source = 'source'
  59. class KeywordEntry(gdata.data.GDEntry):
  60. """Describes a keyword entry"""
  61. class KeywordsFeed(gdata.data.GDFeed):
  62. """Feed of keywords for a particular site"""
  63. entry = [KeywordEntry]
  64. keyword = [Keyword]
  65. class LastCrawled(atom.core.XmlElement):
  66. """Describes the last crawled date of a site"""
  67. _qname = WT_TEMPLATE % 'last-crawled'
  68. class MessageBody(atom.core.XmlElement):
  69. """Message body"""
  70. _qname = WT_TEMPLATE % 'body'
  71. class MessageDate(atom.core.XmlElement):
  72. """Message date"""
  73. _qname = WT_TEMPLATE % 'date'
  74. class MessageLanguage(atom.core.XmlElement):
  75. """Message language"""
  76. _qname = WT_TEMPLATE % 'language'
  77. class MessageRead(atom.core.XmlElement):
  78. """Indicates if the message has already been read"""
  79. _qname = WT_TEMPLATE % 'read'
  80. class MessageSubject(atom.core.XmlElement):
  81. """Message subject"""
  82. _qname = WT_TEMPLATE % 'subject'
  83. class SiteId(atom.core.XmlElement):
  84. """Site URL"""
  85. _qname = WT_TEMPLATE % 'id'
  86. class MessageEntry(gdata.data.GDEntry):
  87. """Describes a message entry"""
  88. wt_id = SiteId
  89. subject = MessageSubject
  90. date = MessageDate
  91. body = MessageBody
  92. language = MessageLanguage
  93. read = MessageRead
  94. class MessagesFeed(gdata.data.GDFeed):
  95. """Describes a messages feed"""
  96. entry = [MessageEntry]
  97. class SitemapEntry(gdata.data.GDEntry):
  98. """Describes a sitemap entry"""
  99. indexed = Indexed
  100. wt_id = SiteId
  101. class SitemapMobileMarkupLanguage(atom.core.XmlElement):
  102. """Describes a markup language for URLs in this sitemap"""
  103. _qname = WT_TEMPLATE % 'sitemap-mobile-markup-language'
  104. class SitemapMobile(atom.core.XmlElement):
  105. """Lists acceptable mobile markup languages for URLs in this sitemap"""
  106. _qname = WT_TEMPLATE % 'sitemap-mobile'
  107. sitemap_mobile_markup_language = [SitemapMobileMarkupLanguage]
  108. class SitemapNewsPublicationLabel(atom.core.XmlElement):
  109. """Specifies the publication label for this sitemap"""
  110. _qname = WT_TEMPLATE % 'sitemap-news-publication-label'
  111. class SitemapNews(atom.core.XmlElement):
  112. """Lists publication labels for this sitemap"""
  113. _qname = WT_TEMPLATE % 'sitemap-news'
  114. sitemap_news_publication_label = [SitemapNewsPublicationLabel]
  115. class SitemapType(atom.core.XmlElement):
  116. """Indicates the type of sitemap. Not used for News or Mobile Sitemaps"""
  117. _qname = WT_TEMPLATE % 'sitemap-type'
  118. class SitemapUrlCount(atom.core.XmlElement):
  119. """Indicates the number of URLs contained in the sitemap"""
  120. _qname = WT_TEMPLATE % 'sitemap-url-count'
  121. class SitemapsFeed(gdata.data.GDFeed):
  122. """Describes a sitemaps feed"""
  123. entry = [SitemapEntry]
  124. class VerificationMethod(atom.core.XmlElement):
  125. """Describes a verification method that may be used for a site"""
  126. _qname = WT_TEMPLATE % 'verification-method'
  127. in_use = 'in-use'
  128. type = 'type'
  129. class Verified(atom.core.XmlElement):
  130. """Describes the verification status of a site"""
  131. _qname = WT_TEMPLATE % 'verified'
  132. class SiteEntry(gdata.data.GDEntry):
  133. """Describes a site entry"""
  134. indexed = Indexed
  135. wt_id = SiteId
  136. verified = Verified
  137. last_crawled = LastCrawled
  138. verification_method = [VerificationMethod]
  139. class SitesFeed(gdata.data.GDFeed):
  140. """Describes a sites feed"""
  141. entry = [SiteEntry]