Skip to content

Commit

Permalink
do gcloud auth at the top (#261)
Browse files Browse the repository at this point in the history
  • Loading branch information
vdlima authored Sep 12, 2024
1 parent 0be49b0 commit a326627
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions tools/SIP_SIPREC_integration_Dialogflow_CURL_commands.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,14 @@
{
"cell_type": "code",
"source": [
"from google.colab import auth as google_auth\n",
"\n",
"import json\n",
"import os\n",
"import re\n",
"\n",
"google_auth.authenticate_user()\n",
"\n",
"# @title Input parameters\n",
"\n",
"PROJECT_ID = \"my-project-id\" # @param {type:\"string\"}\n",
Expand All @@ -33,11 +37,13 @@
"!gcloud services enable dialogflow.googleapis.com\n",
"\n",
"\n",
"# Ensure that the project has Dialogflow APIs enabled\n",
"!gcloud config set project {PROJECT_ID}\n",
"!gcloud services enable dialogflow.googleapis.com\n",
"\n",
"CONTAINS_SPACES_PATTERN = r\"\\s\"\n",
"# If the JWT string has spaces, then use SSO for authentication\n",
"if re.search(CONTAINS_SPACES_PATTERN, JWT):\n",
" from google.colab import auth as google_auth\n",
" google_auth.authenticate_user()\n",
" JWT = !gcloud auth print-access-token\n",
" JWT = JWT[0]\n",
"\n",
Expand Down

0 comments on commit a326627

Please sign in to comment.