Update app.py
Browse files
app.py
CHANGED
|
@@ -11,8 +11,8 @@ GLOBAL_WORKSPACE_ID = None
|
|
| 11 |
GLOBAL_BOT_ID = None
|
| 12 |
|
| 13 |
|
| 14 |
-
#
|
| 15 |
-
|
| 16 |
# -------------------------------------------------------------------
|
| 17 |
# Helper functions for random bot/workspace names
|
| 18 |
# -------------------------------------------------------------------
|
|
@@ -28,7 +28,7 @@ def create_workspace():
|
|
| 28 |
ws_url = "https://api.botpress.cloud/v1/admin/workspaces"
|
| 29 |
headers = {
|
| 30 |
"User-Agent": "Mozilla/5.0",
|
| 31 |
-
"
|
| 32 |
}
|
| 33 |
payload = {"name": generate_random_name()}
|
| 34 |
|
|
@@ -57,7 +57,7 @@ def create_bot(workspace_id):
|
|
| 57 |
headers = {
|
| 58 |
"User-Agent": "Mozilla/5.0",
|
| 59 |
"x-workspace-id": workspace_id,
|
| 60 |
-
"
|
| 61 |
"Content-Type": "application/json"
|
| 62 |
}
|
| 63 |
payload = {"name": generate_random_name()}
|
|
@@ -98,7 +98,7 @@ def install_bot_integration(bot_id, workspace_id):
|
|
| 98 |
url = f"https://api.botpress.cloud/v1/admin/bots/{bot_id}"
|
| 99 |
headers = {
|
| 100 |
"User-Agent": "Mozilla/5.0",
|
| 101 |
-
"
|
| 102 |
"Content-Type": "application/json",
|
| 103 |
"x-bot-id": bot_id,
|
| 104 |
"x-workspace-id": workspace_id
|
|
@@ -135,7 +135,7 @@ def delete_bot(bot_id, workspace_id):
|
|
| 135 |
headers = {
|
| 136 |
"User-Agent": "Mozilla/5.0",
|
| 137 |
"x-workspace-id": workspace_id,
|
| 138 |
-
"
|
| 139 |
}
|
| 140 |
|
| 141 |
try:
|
|
@@ -160,7 +160,7 @@ def delete_workspace(workspace_id):
|
|
| 160 |
url = f"https://api.botpress.cloud/v1/admin/workspaces/{workspace_id}"
|
| 161 |
headers = {
|
| 162 |
"User-Agent": "Mozilla/5.0",
|
| 163 |
-
"
|
| 164 |
}
|
| 165 |
|
| 166 |
try:
|
|
@@ -200,7 +200,7 @@ def browse_pages(urls, wait_for=350, bot_id=None, workspace_id=None):
|
|
| 200 |
"x-bot-id": bot_id,
|
| 201 |
"x-workspace-id": workspace_id,
|
| 202 |
"Content-Type": "application/json",
|
| 203 |
-
"
|
| 204 |
}
|
| 205 |
|
| 206 |
# Prepare the payload for the API
|
|
|
|
| 11 |
GLOBAL_BOT_ID = None
|
| 12 |
|
| 13 |
|
| 14 |
+
# Authorization value used in requests (should be updated with a valid Authorization),
|
| 15 |
+
TOKEN = "Bearer bp_pat_vTuxol25N0ymBpYaWqtWpFfGPKt260IfT784"
|
| 16 |
# -------------------------------------------------------------------
|
| 17 |
# Helper functions for random bot/workspace names
|
| 18 |
# -------------------------------------------------------------------
|
|
|
|
| 28 |
ws_url = "https://api.botpress.cloud/v1/admin/workspaces"
|
| 29 |
headers = {
|
| 30 |
"User-Agent": "Mozilla/5.0",
|
| 31 |
+
"Authorization": TOKEN
|
| 32 |
}
|
| 33 |
payload = {"name": generate_random_name()}
|
| 34 |
|
|
|
|
| 57 |
headers = {
|
| 58 |
"User-Agent": "Mozilla/5.0",
|
| 59 |
"x-workspace-id": workspace_id,
|
| 60 |
+
"Authorization": TOKEN,
|
| 61 |
"Content-Type": "application/json"
|
| 62 |
}
|
| 63 |
payload = {"name": generate_random_name()}
|
|
|
|
| 98 |
url = f"https://api.botpress.cloud/v1/admin/bots/{bot_id}"
|
| 99 |
headers = {
|
| 100 |
"User-Agent": "Mozilla/5.0",
|
| 101 |
+
"Authorization": TOKEN,
|
| 102 |
"Content-Type": "application/json",
|
| 103 |
"x-bot-id": bot_id,
|
| 104 |
"x-workspace-id": workspace_id
|
|
|
|
| 135 |
headers = {
|
| 136 |
"User-Agent": "Mozilla/5.0",
|
| 137 |
"x-workspace-id": workspace_id,
|
| 138 |
+
"Authorization": TOKEN
|
| 139 |
}
|
| 140 |
|
| 141 |
try:
|
|
|
|
| 160 |
url = f"https://api.botpress.cloud/v1/admin/workspaces/{workspace_id}"
|
| 161 |
headers = {
|
| 162 |
"User-Agent": "Mozilla/5.0",
|
| 163 |
+
"Authorization": TOKEN
|
| 164 |
}
|
| 165 |
|
| 166 |
try:
|
|
|
|
| 200 |
"x-bot-id": bot_id,
|
| 201 |
"x-workspace-id": workspace_id,
|
| 202 |
"Content-Type": "application/json",
|
| 203 |
+
"Authorization": TOKEN
|
| 204 |
}
|
| 205 |
|
| 206 |
# Prepare the payload for the API
|