Google Drive Python API resumable upload error 401 after 2 hours

后端 未结 2 1581
醉梦人生
醉梦人生 2020-12-07 02:30

First of all, I\'m sorry if this is a too silly question... this is the first time I\'m trying to use any of the technologies involved in this script (Python, the drive api,

2条回答
  •  一个人的身影
    2020-12-07 03:22

    I assume the problem is that after the 1-2 hour limit your access token to your remote database expires; cutting off your connection with the remote server. I think what you could do is look at your hosts API manual... They should have something in there about 'refresh tokens'(They get you another Access Token, note some hosts only allow you to use one refresh token per session), if they are allowed an unlimited amount you can use a combination of a timer and AJAX to keep asking for more access tokens.

    If not then you would have a make an AJAX request for another Authorization Token and exchange that for another Access token every hour. That sounds like a very rigorous process but I think that is the only way if your token keeps expiring.

    Also just on another note have you tried other methods of uploading? If you said the above script ran for 1-2 hours and it only uploaded 1.44% of the file that could take 100+ hours to fully upload (Way too long for only 3 Gigs).

提交回复
热议问题