-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Closed
Labels
🚨This issue needs some love.This issue needs some love.status: acknowledgedtriage meI really want to be triaged.I really want to be triaged.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Description
We (@adrianAhne and I) have found a small bug on the Python client code.
When using the Google API Python client to cancel a job, the Python code fails because it expects a body. However, the API documentation clearly states that there is no body to this request (https://cloud.google.com/dataproc/docs/reference/rest/v1beta2/projects.regions.jobs/cancel ). I do not know if the discovery process is wrong or it is something else.
Here is a simple excerpt to reproduce the problem:
from oauth2client.client import GoogleCredentials
from googleapiclient.discovery import build
credentials = GoogleCredentials.get_application_default()
service = build('dataproc', 'v1beta2', credentials=credentials)
request = service.projects().regions().jobs().cancel(
projectId='my_project_id',
region='global', # cannot be anything else than global at the moment
jobId='my_job_id')
result = request.execute()
Which fails when creating the request with the following error:
TypeError: Missing required parameter "body"
There is a workaround, which is to remove the body from the request:
request = service.projects().regions().jobs().cancel(
projectId='my_project_id',
region='global', # cannot be anything else than global at the moment
jobId='my_job_id',
body='') # Set body to something, None does not work
request.body = None
request.body_size = 0
result = request.execute()
Metadata
Metadata
Assignees
Labels
🚨This issue needs some love.This issue needs some love.status: acknowledgedtriage meI really want to be triaged.I really want to be triaged.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.Error or flaw in code with unintended results or allowing sub-optimal usage patterns.