def createWorksheet(self,url,title,cols,rows):
header = { 'User-Agent' : self.user_agent, 'Authorization' : 'GoogleLogin auth=%s' % self.authorization.getToken('wise'), 'GData-Version' : '3.0', 'Content-Type': 'application/atom+xml' }
entry = '<?xml version=\'1.0\' encoding=\'UTF-8\'?><entry xmlns="http://www.w3.org/2005/Atom" xmlns:gs="http://schemas.google.com/spreadsheets/2006"><title>A worksheetdadf</title><gs:rowCount>100</gs:rowCount><gs:colCount>20</gs:colCount></entry>'
req = urllib2.Request(url, entry, header)
try:
response = urllib2.urlopen(req)
except urllib2.URLError, e:
if e.code == 403 or e.code == 401:
self.service.refreshToken()
req = urllib2.Request(url, None, self.service.getHeadersList())
try:
response = urllib2.urlopen(req)
except urllib2.URLError, e:
xbmc.log(self.addon.getAddonInfo('name') + ': ' + str(e), xbmc.LOGERROR)
return False
else:
xbmc.log(self.addon.getAddonInfo('name') + ': ' + str(e), xbmc.LOGERROR)
return False
response.read()
response.close()
return True
#
# returns a list of spreadsheets contained in the Google Docs account
#
gSpreadsheets.py 文件源码
python
阅读 18
收藏 0
点赞 0
评论 0
评论列表
文章目录