Unable to make an API call "discovery.build", throwing error 400 for dialogflow service
from googleapiclient import discovery
from oauth2client.client import GoogleCredentials
credentials = GoogleCredentials.get_application_default()
webhook_name= "projects/<project-name>/locations/us-central1/agents/<agent-id>"
service_client = discovery.build('dialogflow', 'v3', credentials=credentials, discoveryServiceUrl="https://www.googleapis.com/discovery/v1/apis/us-central1-dialogflow/v3/rest")
The above code throws the following error :
HttpError: <HttpError 400 when requesting https://dialogflow.googleapis.com/v3/projects/
Hi @charul97,
Static discovery artifacts which are used to build clients are now included in version 2.x.x of google-api-python-client. Please can you try the following code to build the client using the static discovery artifacts?
from googleapiclient import discovery
service_client = discovery.build('dialogflow', 'v3')
Moving forward, you'll only need to provide discoveryServiceUrl when you need to access a discovery artifact which is not part of the public directory here.
Hi @charul97,
Static discovery artifacts which are used to build clients are now included in version 2.x.x of
google-api-python-client. Please can you try the following code to build the client using the static discovery artifacts?from googleapiclient import discovery service_client = discovery.build('dialogflow', 'v3')Moving forward, you'll only need to provide
discoveryServiceUrlwhen you need to access a discovery artifact which is not part of the public directory here.
I get the same error even if I remove discoveryServiceUrl
Hi @charul97,
I'm not able to reproduce the problem. Please can you share the version of google-api-python-client that you're using with pip show google-api-python-client?
Hi @charul97, I'm not able to reproduce the problem. Please can you share the version of
google-api-python-clientthat you're using withpip show google-api-python-client?
Name: google-api-python-client Version: 2.2.0 Summary: Google API Client Library for Python
Regretfully I'm not able to reproduce this issue. Please re-open this issue if you're still having trouble. I'm happy to troubleshoot further.