本文整理汇总了Python中resource.Resource.website方法的典型用法代码示例。如果您正苦于以下问题:Python Resource.website方法的具体用法?Python Resource.website怎么用?Python Resource.website使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类resource.Resource
的用法示例。
在下文中一共展示了Resource.website方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: build
# 需要导入模块: from resource import Resource [as 别名]
# 或者: from resource.Resource import website [as 别名]
def build(cls):
#Need admin acc to import
url = "https://spreadsheets.google.com/feeds/list/0ApN6pOTp7qkZdDVDMW1YSEZUelV2TFUwcFpzblM4cnc/od6/public/values?alt=json"
result = urlfetch.fetch(url)
if result.status_code == 200:
feed_obj = simplejson.loads(result.content)
if "feed" in feed_obj:
entries = feed_obj["feed"]["entry"]
# Make an application entity for each entry in feed
last = {}
# cls.response.out.write('<html><body>')
for entry in entries:
name = entry["gsx$name"]['$t']
# self.response.out.write("<p>" + name + "</p>");
note = entry["gsx$notes"]['$t']
# If new name
if not name in last.keys():
res = Resource()
res.name = name
res.note = []
logging.debug("Resource repeated %s", name)
res.website = entry["gsx$website"]['$t']
res.overview = entry["gsx$overview"]['$t']
res.audience = entry["gsx$audience"]['$t']
content = entry["gsx$content"]['$t']
if len(content) == 0:
res.content = 0
else:
res.content = int(content)
presentation = entry["gsx$presentation"]['$t']
if len(presentation) == 0:
res.presentation = 0
else:
res.presentation = int(presentation)
spanish = entry["gsx$spanish"]['$t']
if spanish == "No":
res.spanish = False
else :
res.spanish = True
res.license = entry["gsx$license"]['$t']
res.grade = entry["gsx$grade"]['$t']
else:
res = last[name] # Resource
res.notes.append(note)
logging.debug("New resource found %s", name)
res.put()
last[name] = res
resources = Resource.getResources()
i = 0
for res in resources:
# self.response.out.write("<p>" + str(res.name) + "</p>");
i = i + 1
#print ("<p>" + str(res) + "</p>")
# cls.response.out.write('Num Resources ' + str(i))
# cls.response.out.write('</body></html>')
# self.response.headers['Content-Type'] = 'text/plain'
# self.response.out.write('<html><body>')
# self.response.out.write("<p>" + " " + name + website + overview + audience + content + presentation + spanish + notes + link_license + grade)
# self.response.out.write('</body></html>')
# application = webapp.WSGIApplication([('/', MainPage)], debug=True)
#
# def main():
# run_wsgi_app(application)
#
# if __name__ == "__main__":
# main()