[FIX] google_drive: code want uncompressed data
This commit removes the request of having gzip or deflate data for two requests to google drive API. Previously the code worked since google api would send ungzipped data (maybe base on urllib2 user agent or other input parameters) but after a recent change on google part, it is not anymore the case. closes #8243 opw-648007 note: if we did not do this, we would either need to use requests or add custom uncompressing code for urllib2 response content.
This commit is contained in:
parent
42ecf5e346
commit
19e9163367
|
@ -80,7 +80,7 @@ class config(osv.Model):
|
|||
client_secret=google_drive_client_secret,
|
||||
grant_type="refresh_token",
|
||||
scope=scope or 'https://www.googleapis.com/auth/drive'))
|
||||
headers = {"Content-type": "application/x-www-form-urlencoded", "Accept-Encoding": "gzip, deflate"}
|
||||
headers = {"Content-type": "application/x-www-form-urlencoded"}
|
||||
try:
|
||||
req = urllib2.Request('https://accounts.google.com/o/oauth2/token', data, headers)
|
||||
content = urllib2.urlopen(req, timeout=TIMEOUT).read()
|
||||
|
@ -100,7 +100,7 @@ class config(osv.Model):
|
|||
access_token = self.get_access_token(cr, uid, context=context)
|
||||
# Copy template in to drive with help of new access token
|
||||
request_url = "https://www.googleapis.com/drive/v2/files/%s?fields=parents/id&access_token=%s" % (template_id, access_token)
|
||||
headers = {"Content-type": "application/x-www-form-urlencoded", "Accept-Encoding": "gzip, deflate"}
|
||||
headers = {"Content-type": "application/x-www-form-urlencoded"}
|
||||
try:
|
||||
req = urllib2.Request(request_url, None, headers)
|
||||
parents = urllib2.urlopen(req, timeout=TIMEOUT).read()
|
||||
|
|
Loading…
Reference in New Issue