Skip to content

YouTube Reporting media().download(...) 400 content breaks HttpError._get_reason #225

@AlexRiina

Description

@AlexRiina

From the discover tools, media().download(...) is triggering a request to https://youtubereporting.googleapis.com/v1/media/test?alt=json which is returning a 400 for me with the following content:

[{
  "error": {
    "code": 400,
    "message": "Invalid value for query parameter 'alt'. It must be set to \"media\".",
    "errors": [
      {
        "message": "Invalid value for query parameter 'alt'. It must be set to \"media\".",
        "domain": "global",
        "reason": "badRequest"
      }
    ],
    "status": "INVALID_ARGUMENT"
  }
}
]

The contents of the response are put into an HttpError in HttpRequest.execute but the _get_reason expects {"error": ...} directly instead of [{"error": ...}] so it is crashing with

<type 'str'>: (<type 'exceptions.TypeError'>, TypeError('list indices must be integers, not str',))

I'm not sure if there is a valid reason to have a list of errors and the client code should support it or if the server code should return a single error with the "errors" subelement filled in (as it is).

Metadata

Metadata

Assignees

Labels

🚨This issue needs some love.triage meI really want to be triaged.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions