在 Google App Engine 中,我试图获取特定记录以及与之关联的内容。我使用以下(相关)代码(导入所有必要的 GData 并验证客户端):
sclient = gdata.spreadsheet.text_db.DatabaseClient(username, password)
gdata.alt.appengine.run_on_appengine(sclient)
gdata.alt.appengine.run_on_appengine(sclient._GetDocsClient())
gdata.alt.appengine.run_on_appengine(sclient._GetSpreadsheetsClient())
ss = sclient.GetDatabases(spreadsheet_key="0AqKqcvXam_kcdFlfckZfVzRiaVpRelp2T1FsVl9rRHc")
processedSheet = ss[0].GetTables(worksheet_id=1)
targetTotals = processedSheet[0].GetRecord(row_number=1)
total1 = targetTotals.content["votea"]
问题出在最后一行。它抛出这个错误:
AttributeError: 'NoneType' object has no attribute 'content'
我查看了 GData 电子表格 text_db 模块的源代码,返回行显示:
return Record(content=None, row_entry=row_feed.entry[0],
意味着设计的功能不返回内容?这没有太多意义。我是否使用了错误的功能。我想要完成的是连续获取单元格的值。我的电子表格(已处理的Sheet 所指的)具有名为“votea”、“voteb”等的列标题。第一行是整数。那么,有什么想法吗?