As mentioned in the documentation, I have setup cloud account along with activating the dialogflow API. Then I activated dialogflow V2 in my dialogflow.com account along with setting the same google project in it.
I downloaded the google credentials in JSON format and set it's path for authentication too accordingly.
After doing all this, when I ran
from google.cloud import storage
storage_client = storage.Client()
buckets = list(storage_client.list_buckets())
print(buckets)
It gave me the error,
OSError: Project was not passed and could not be determined from the environment.
So, I set the project name in the storage client itself.
storage_client = storage.Client(project='[Project-id]')
So, that solved the problem with the code, still, I think it should have detected the project-id on its own without having to provide the project id as has been given in the documentation.
After all this, I tried running the below program, to check the connection,
import dialogflow_v2beta1
client = dialogflow_v2beta1.AgentsClient()
parent = client.project_path('[Project-id]')
response = client.import_agent(parent)
def callback(operation_future):
result = operation_future.result()
response.add_done_callback(callback)
metadata = response.metadata()
I am getting the following error after this,
PermissionDenied: 403 Dialogflow API has not been used in project usable-auth-library before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/dialogflow.googleapis.com/overview?project=usable-auth-library then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.
Any help would be appreciated.