sherin
sherin

Reputation: 355

google Drive api v3 file upload errors

The google drive api on python is showing the following error. My file upload code is already mentioned on Google Drive api v3 file upload errors via python

I am getting the following errors,

 File "/opt/cppython/lib/python3.8/site-packages/httplib2/__init__.py", line 1685, in _request
    raise RedirectMissingLocation(
httplib2.RedirectMissingLocation: Redirected but the response is missing a Location: header.

My pips are as follows,

google-api-core          1.22.4
google-api-python-client 1.12.3
google-auth              1.22.1
google-auth-httplib2     0.0.4
google-auth-oauthlib     0.4.1
googleapis-common-protos 1.52.0
httplib2                 0.18.1

I am using python 3.8.6 . Some old posts say it need to downgrade some packages. But I hope this will be some other issues.

Upvotes: 2

Views: 616

Answers (1)

sherin
sherin

Reputation: 355

This issue has been solved by modifying the following connection code too google drive api.

SCOPES = ['https://www.googleapis.com/auth/drive','https://www.googleapis.com/auth/drive.file','https://www.googleapis.com/auth/drive.appdata']
credentials = ServiceAccountCredentials.from_json_keyfile_name('json-file', SCOPES)
http=Http()
http.redirect_codes = http.redirect_codes - {308}
http_auth = credentials.authorize(http)
drive_service = build('drive', 'v3', http=http_auth,cache_discovery=False)

Upvotes: 3

Related Questions