def createRow(self,url, folderID, folderName, fileID, fileName):
# header = { 'User-Agent' : self.user_agent, 'Authorization' : 'GoogleLogin auth=%s' % self.authorization.getToken('wise'), 'GData-Version' : '3.0', 'Content-Type': 'application/atom+xml'}
header = { 'User-Agent' : self.user_agent, 'Authorization' : 'Bearer ' + self.service.authorization.getToken('auth_access_token'), '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:gsx="http://schemas.google.com/spreadsheets/2006/extended"> <gsx:source>S3E12 - The Red Dot.avi-0002</gsx:source><gsx:nfo>test.nfo</gsx:nfo><gsx:show>Seinfeld</gsx:show><gsx:season>3</gsx:season><gsx:episode>1</gsx:episode><gsx:part>1</gsx:part><gsx:watched>0</gsx:watched><gsx:duration>1</gsx:duration></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
阅读 17
收藏 0
点赞 0
评论 0
评论列表
文章目录