2

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.

2
  • Can I ask you about your question? Can you provide your current script for replicating the error of Redirected but the response is missing a Location: header.? Because when I tested your script in your link, I confirmed the error of Bad Request which is not Redirected but the response is missing a Location: header.. Commented Oct 30, 2020 at 8:33
  • Now I noticed that you had answered for your question. I apologize for this. I'm glad your issue was resolved. Commented Oct 30, 2020 at 8:46

1 Answer 1

3

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)
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.