简体   繁体   中英

How to get api token to access dialogflow in python

Im not sure how I can usemy service account and Dialogflow API key to get an API token using OAuth2 to get an access token for google. Could someone share a code snippet

I want to access this API: https://cloud.google.com/dialogflow/es/docs/reference/rest/v2/projects.agent.entityTypes/list

In order to use the Dialogflow API (in this case, list all the entity types in the specified agent) you have to:

  1. Enable the Dialogflow API for your project
  2. Go to the Create service account key page. From the Service account list, select New service account , enter a name in the Service account name field.
  3. From the Role list, select Project > Owner.
  4. Click Create . A JSON file that contains your key downloads to your computer.
  5. Once you have the JSON file, you need to set an environment variable in a shell session GOOGLE_APPLICATION_CREDENTIALS="/path/to/key.json" .

You can access the API via REST , gRPC or a client library . In this repository, there are some samples with the python client library.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM