DUYNT / google-api-python-client

Automatically exported from code.google.com/p/google-api-python-client
Other
0 stars 0 forks source link

Resumable media upload fails once the access_token expires. #231

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
First of all, I don't really know for sure this is a bug, for I'm too beginner 
with both the API and Python. But I tried several different ways and got the 
same error, so I thought it might really be a bug.

When uploading a large file (one that takes more than 1~2 hours to upload 
completely, if I use resumable upload, after about 1h, the upload is 
interrupted with 401 error from server. After some digging in the API 
documentation and source code, I found out that it automatically refreshs the 
access token using the refresh token when it gets this error. Thing is that, 
although it does change the access token, the server keeps responding with 401, 
no matter how many times the access token is refreshed.

I'm attaching the code I used here and copying the terminal output... the 
output lines for the http.request.credentials.access_token are for debugging 
purposes.

ya29.AHES6ZTo_-0oDqwn3JnU2uCR2bRjpRGP0CSQSMHGr6KvgEE
Uploaded 2.28%
ya29.AHES6ZTo_-0oDqwn3JnU2uCR2bRjpRGP0CSQSMHGr6KvgEE
Uploaded 2.29%
ya29.AHES6ZTo_-0oDqwn3JnU2uCR2bRjpRGP0CSQSMHGr6KvgEE
Uploaded 2.29%
ya29.AHES6ZTo_-0oDqwn3JnU2uCR2bRjpRGP0CSQSMHGr6KvgEE
Uploaded 2.30%
ya29.AHES6ZTo_-0oDqwn3JnU2uCR2bRjpRGP0CSQSMHGr6KvgEE
Error (401)... retrying.
ya29.AHES6ZQqp3_qbWsTk4yVDdHnlwc_7GvPZiFIReDnhIIiHao
Error (401)... retrying.
ya29.AHES6ZSqx90ZOUKqDEP4AAfWCVgXZYT2vJAiLwKDRu87JOs
Error (401)... retrying.
ya29.AHES6ZTp0RZ6U5K5UdDom0gq3XHnyVS-2sVU9hILOrG4o3Y
Error (401)... retrying.
ya29.AHES6ZSR-IOiwJ_p_Dm-OnCanVIVhCZLs7H_pYLMGIap8W0
Error (401)... retrying.
ya29.AHES6ZRnmM-YIZj4S8gvYBgC1M8oYy4Hv5VlcwRqgnZCOCE
Error (401)... retrying.
ya29.AHES6ZSF7Q7C3WQYuPAWrxvqbTRsipaVKhv_TfrD_gef1DE
Error (401)... retrying.
ya29.AHES6ZTsGzwIIprpPhCrqmoS3UkPsRzst5YHqL-zXJmz6Ak
Error (401)... retrying.
ya29.AHES6ZSS_1ZBiQJvZG_7t5uW3alsy1piGe4-u2YDnwycVrI
Error (401)... retrying.
ya29.AHES6ZTLFbBS8mSFWQ9zK8cgbX8RPeLghPxkfiKY54hBB-0
Error (401)... retrying.
ya29.AHES6ZQBeMWY50z6fWXvaCcd5_AJr_AYOuL2aiNKpK-mmyU
Error (401)... retrying.
ya29.AHES6ZTs2mYYSEyOqI_Ms4itKDx36t39Oc5RNZHkV4Dq49c
Retries limit exceeded! Aborting.

My version infos:
Debian Lenny, with kernel 2.6.26-2-686.
Python 2.5.2 (r252:60911, Jan 24 2010, 14:53:14) 
[GCC 4.3.2] on linux2

I don't really know how to find the version of the api client, but I got it 
from pip install about a week ago (both the google-api-python-client and ssl).

Original issue reported on code.google.com by grfro...@gmail.com on 13 Jan 2013 at 5:51

Attachments:

GoogleCodeExporter commented 9 years ago
can anyone confirm that this is indeed fixed? Nothing changed on my end - still 
getting 401 errors.

Original comment by Thwai...@gmail.com on 8 Dec 2014 at 10:54

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
It seems it works. I uploaded 1 file over 1 hour and 1 file over 2 hours, both 
completed sucessfully.

Original comment by psyfre...@gmail.com on 8 Dec 2014 at 3:07

GoogleCodeExporter commented 9 years ago
I can confirm that it's now working for me too (using the Java client 
Stream2GDrive).

Original comment by martin.b...@onslip.com on 21 Dec 2014 at 6:42

GoogleCodeExporter commented 9 years ago
It works for me - (php client)

Original comment by a.vent...@gluak.com on 26 Jan 2015 at 1:22

GoogleCodeExporter commented 9 years ago
All I read is that the problem is fixed, but nobody says what was fixed exactly.

What happens if my access_token expires in one minute and I upload a file that 
takes two minutes to complete?
Does this fix resolve that case as well? or it just targets the case of 1 hour 
or longer uploads?
Is the new (fixed) behaviour documented somewhere?

Original comment by HRG....@gmail.com on 7 Mar 2015 at 4:22