google-api-python-client icon indicating copy to clipboard operation
google-api-python-client copied to clipboard

'alt' Parameter Does Not Work in 'files().get()'

Open Scemist opened this issue 2 years ago • 0 comments

The alt option does not work on files().get(): alt as [json, media or proto] always returns the json metadata format.

There is no error, but it ignores the parameter.

Environment details

  • Alpine Linux 3.18.2
  • Python 3.11.4
  • Pip 23.1.2
  • google-api-python-client 2.94.0

Steps to reproduce

  1. Normally Use the Library;
  2. After successfully auth and get the file id;
  3. Use any of the following lines of code to get the file content:

Code example

If You Pass Whatever Accepted Option, The Reponse is Always the Metadata

file = drive.files().get(alt="media", fileId=id).execute()
file = drive.files().get(alt="proto", fileId=id).execute()
file = drive.files().get(alt="json", fileId=id).execute()

The response:

{
  "id": "dfjjh1394hf1eijdhf1s",
  "kind": "drive#file",
  "mimeType": "text/plain",
  "name": "Filename"
}

But if You Try a Wrong Option, It Throws the Error as It Should

 file = drive.files().get(alt="nonexistante", fileId=id).execute()

The Error:

TypeError: Parameter "alt" value "nonexistante" is not an allowed value in "['json', 'media', 'proto']"

Scemist avatar Jul 20 '23 01:07 Scemist