diff --git a/README.md b/README.md
index fe8769a..c22abf6 100644
--- a/README.md
+++ b/README.md
@@ -51,6 +51,14 @@ Appwrite playground is a simple way to explore the Appwrite API & Appwrite Pytho
* List Functions
* Delete Function
+### YouTube Video
+
+[Interact with appwrite using python : YouTube](https://youtu.be/TbIJUwTTTyc)
+
+### Jupyter Notebook
+
+[Jupyter Notebook](./appwrite_test.ipynb)
+
## Contributing
All code contributions - including those of people having commit access - must go through a pull request and approved by a core developer before being merged. This is to ensure proper review of all the code.
diff --git a/appwrite_test.ipynb b/appwrite_test.ipynb
new file mode 100644
index 0000000..8d7110f
--- /dev/null
+++ b/appwrite_test.ipynb
@@ -0,0 +1,883 @@
+{
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "id": "0894b02c",
+ "metadata": {
+ "toc": true
+ },
+ "source": [
+ "
Table of Contents
\n",
+ ""
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "6e9758e9",
+ "metadata": {},
+ "source": [
+ "# Import Libraries"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "id": "72b1116e",
+ "metadata": {
+ "ExecuteTime": {
+ "end_time": "2023-03-02T08:52:11.179054Z",
+ "start_time": "2023-03-02T08:52:10.820202Z"
+ }
+ },
+ "outputs": [],
+ "source": [
+ "from time import sleep\n",
+ "from random import randrange\n",
+ "from sys import maxsize\n",
+ "import pandas as pd\n",
+ "from appwrite.client import Client\n",
+ "from appwrite.services.users import Users\n",
+ "from appwrite.services.databases import Databases\n",
+ "from appwrite.services.storage import Storage\n",
+ "from appwrite.services.account import Account\n",
+ "from appwrite.services.functions import Functions\n",
+ "from appwrite.input_file import InputFile\n",
+ "from appwrite.permission import Permission\n",
+ "from appwrite.role import Role\n",
+ "from appwrite.id import ID\n",
+ "\n",
+ "# Helper method to print green colored output.\n",
+ "def p(info):\n",
+ " print(\"\\033[32;1m\"+str(info)+\"\\033[0m\")"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "0a8ed79f",
+ "metadata": {},
+ "source": [
+ "# Set Arguments"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "id": "d6a76280",
+ "metadata": {
+ "ExecuteTime": {
+ "end_time": "2023-03-02T08:50:47.005546Z",
+ "start_time": "2023-03-02T08:50:46.999032Z"
+ }
+ },
+ "outputs": [],
+ "source": [
+ "# Read the docs at https://appwrite.io/docs to get more information\n",
+ "# about API keys and Project IDs\n",
+ "client = Client()\n",
+ "client.endpoint = 'http://MY_HOSTNAME/v1'\n",
+ "client.project = 'my_project_id'\n",
+ "client.key = 'MY_SECRET_KEY'\n",
+ "client.self_signed=False\n",
+ "# client.set_jwt('JWT') # Use this to authenticate with JWT instead of API_KEY\n",
+ "\n",
+ "databases = Databases(client)\n",
+ "storage = Storage(client)\n",
+ "functions = Functions(client)\n",
+ "users = Users(client)\n",
+ "\n",
+ "database_id = 'database_id'\n",
+ "collection_id = 'collection_id'\n",
+ "document_id = 'document_id'\n",
+ "user_id = 'user_id'\n",
+ "bucket_id = 'bucket_id'\n",
+ "file_id = 'file_id'\n",
+ "# document_id = None"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "id": "249e2fd8",
+ "metadata": {},
+ "outputs": [],
+ "source": []
+ },
+ {
+ "cell_type": "markdown",
+ "id": "a5c2dc2e",
+ "metadata": {},
+ "source": [
+ "# Test Individual Functionalities"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "id": "18b1c1c1",
+ "metadata": {
+ "ExecuteTime": {
+ "end_time": "2023-03-01T13:54:59.648656Z",
+ "start_time": "2023-03-01T13:54:59.459151Z"
+ }
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "\u001b[32;1mRunning Create Database API\u001b[0m\n",
+ "{'$id': '63ff5933737f37fc287b', 'name': 'Movies', '$createdAt': '2023-03-01T13:54:59.473+00:00', '$updatedAt': '2023-03-01T13:54:59.473+00:00'}\n"
+ ]
+ }
+ ],
+ "source": [
+ "def create_database():\n",
+ " global database_id\n",
+ "\n",
+ " p(\"Running Create Database API\")\n",
+ " response = databases.create(\n",
+ " database_id=ID.unique(),\n",
+ " name='Movies',\n",
+ " )\n",
+ " database_id = response['$id']\n",
+ " print(response)\n",
+ " \n",
+ "create_database()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "id": "0ecefa71",
+ "metadata": {
+ "ExecuteTime": {
+ "end_time": "2023-03-01T13:55:27.124933Z",
+ "start_time": "2023-03-01T13:55:24.863416Z"
+ }
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "\u001b[32;1mRunning Create Collection API\u001b[0m\n",
+ "{'$id': '63ff594cd836f0e980b6', '$createdAt': '2023-03-01T13:55:24.886+00:00', '$updatedAt': '2023-03-01T13:55:24.886+00:00', '$permissions': ['read(\"any\")', 'create(\"users\")', 'update(\"users\")', 'delete(\"users\")'], 'databaseId': '63ff5933737f37fc287b', 'name': 'Movies', 'enabled': True, 'documentSecurity': True, 'attributes': [], 'indexes': []}\n",
+ "{'key': 'name', 'type': 'string', 'status': 'processing', 'required': True, 'array': False, 'size': 255, 'default': None}\n",
+ "{'key': 'release_year', 'type': 'integer', 'status': 'processing', 'required': True, 'array': False, 'min': 0, 'max': 9999, 'default': None}\n",
+ "{'key': 'rating', 'type': 'double', 'status': 'processing', 'required': True, 'array': False, 'min': 0, 'max': 99.99, 'default': None}\n",
+ "{'key': 'kids', 'type': 'boolean', 'status': 'processing', 'required': True, 'array': False, 'default': None}\n",
+ "{'key': 'email', 'type': 'string', 'status': 'processing', 'required': False, 'array': False, 'format': 'email', 'default': None}\n",
+ "{'key': 'name_email_idx', 'type': 'fulltext', 'status': 'processing', 'attributes': ['name', 'email'], 'orders': []}\n"
+ ]
+ }
+ ],
+ "source": [
+ "def create_collection():\n",
+ " global collection_id\n",
+ "\n",
+ " p(\"Running Create Collection API\")\n",
+ " response = databases.create_collection(\n",
+ " database_id,\n",
+ " collection_id=ID.unique(),\n",
+ " name='Movies',\n",
+ " document_security=True,\n",
+ " permissions=[\n",
+ " Permission.read(Role.any()),\n",
+ " Permission.create(Role.users()),\n",
+ " Permission.update(Role.users()),\n",
+ " Permission.delete(Role.users()),\n",
+ " ]\n",
+ " )\n",
+ "\n",
+ " collection_id = response['$id']\n",
+ " print(response)\n",
+ "\n",
+ " response = databases.create_string_attribute(\n",
+ " database_id,\n",
+ " collection_id,\n",
+ " key='name',\n",
+ " size=255,\n",
+ " required=True,\n",
+ " )\n",
+ " print(response)\n",
+ "\n",
+ " response = databases.create_integer_attribute(\n",
+ " database_id,\n",
+ " collection_id,\n",
+ " key='release_year',\n",
+ " required=True,\n",
+ " min=0,\n",
+ " max=9999\n",
+ " )\n",
+ " print(response)\n",
+ "\n",
+ " response = databases.create_float_attribute(\n",
+ " database_id,\n",
+ " collection_id,\n",
+ " key='rating',\n",
+ " required=True,\n",
+ " min=0.0,\n",
+ " max=99.99\n",
+ " )\n",
+ " print(response)\n",
+ "\n",
+ " response = databases.create_boolean_attribute(\n",
+ " database_id,\n",
+ " collection_id,\n",
+ " key='kids',\n",
+ " required=True\n",
+ " )\n",
+ " print(response)\n",
+ "\n",
+ " response = databases.create_email_attribute(\n",
+ " database_id,\n",
+ " collection_id,\n",
+ " key='email',\n",
+ " required=False,\n",
+ " default=\"\"\n",
+ " )\n",
+ " print(response)\n",
+ "\n",
+ " # Wait for attributes to be created\n",
+ " sleep(2)\n",
+ "\n",
+ " response = databases.create_index(\n",
+ " database_id,\n",
+ " collection_id,\n",
+ " key='name_email_idx',\n",
+ " type=\"fulltext\",\n",
+ " attributes=['name', 'email']\n",
+ " )\n",
+ " print(response)\n",
+ " \n",
+ "create_collection()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "id": "2d85669b",
+ "metadata": {
+ "ExecuteTime": {
+ "end_time": "2023-03-01T13:55:44.238299Z",
+ "start_time": "2023-03-01T13:55:44.202178Z"
+ }
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "\u001b[32;1mRunning List Collection API\u001b[0m\n",
+ "{'total': 1, 'collections': [{'$id': '63ff594cd836f0e980b6', '$createdAt': '2023-03-01T13:55:24.886+00:00', '$updatedAt': '2023-03-01T13:55:24.886+00:00', '$permissions': ['read(\"any\")', 'create(\"users\")', 'update(\"users\")', 'delete(\"users\")'], 'databaseId': '63ff5933737f37fc287b', 'name': 'Movies', 'enabled': True, 'documentSecurity': True, 'attributes': [{'key': 'name', 'type': 'string', 'status': 'available', 'required': True, 'array': False, 'size': 255, 'default': None}, {'key': 'release_year', 'type': 'integer', 'status': 'available', 'required': True, 'array': False, 'min': 0, 'max': 9999, 'default': None}, {'key': 'rating', 'type': 'double', 'status': 'available', 'required': True, 'array': False, 'min': 0, 'max': 99.99, 'default': None}, {'key': 'kids', 'type': 'boolean', 'status': 'available', 'required': True, 'array': False, 'default': None}, {'key': 'email', 'type': 'string', 'status': 'available', 'required': False, 'array': False, 'format': 'email', 'default': None}], 'indexes': [{'key': 'name_email_idx', 'type': 'fulltext', 'status': 'available', 'attributes': ['name', 'email'], 'orders': []}]}]}\n"
+ ]
+ }
+ ],
+ "source": [
+ "def list_collections():\n",
+ " p(\"Running List Collection API\")\n",
+ " response = databases.list_collections(database_id)\n",
+ " print(response)\n",
+ " \n",
+ "list_collections()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "id": "1096faec",
+ "metadata": {
+ "ExecuteTime": {
+ "end_time": "2023-03-01T13:56:20.601258Z",
+ "start_time": "2023-03-01T13:56:20.172982Z"
+ }
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "\u001b[32;1mRunning Get Account API\u001b[0m\n"
+ ]
+ },
+ {
+ "ename": "AppwriteException",
+ "evalue": "app.63c39409d6a8a5cd05bd@service.127.0.0.1 (role: applications) missing scope (account)",
+ "output_type": "error",
+ "traceback": [
+ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
+ "\u001b[0;31mHTTPError\u001b[0m Traceback (most recent call last)",
+ "File \u001b[0;32m~/.local/lib/python3.11/site-packages/appwrite/client.py:130\u001b[0m, in \u001b[0;36mClient.call\u001b[0;34m(self, method, path, headers, params)\u001b[0m\n\u001b[1;32m 119\u001b[0m response \u001b[38;5;241m=\u001b[39m requests\u001b[38;5;241m.\u001b[39mrequest( \u001b[38;5;66;03m# call method dynamically https://stackoverflow.com/a/4246075/2299554\u001b[39;00m\n\u001b[1;32m 120\u001b[0m method\u001b[38;5;241m=\u001b[39mmethod,\n\u001b[1;32m 121\u001b[0m url\u001b[38;5;241m=\u001b[39m\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_endpoint \u001b[38;5;241m+\u001b[39m path,\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 127\u001b[0m verify\u001b[38;5;241m=\u001b[39m(\u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_self_signed),\n\u001b[1;32m 128\u001b[0m )\n\u001b[0;32m--> 130\u001b[0m \u001b[43mresponse\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mraise_for_status\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 132\u001b[0m content_type \u001b[38;5;241m=\u001b[39m response\u001b[38;5;241m.\u001b[39mheaders[\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mContent-Type\u001b[39m\u001b[38;5;124m'\u001b[39m]\n",
+ "File \u001b[0;32m/usr/lib/python3/dist-packages/requests/models.py:1021\u001b[0m, in \u001b[0;36mResponse.raise_for_status\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 1020\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m http_error_msg:\n\u001b[0;32m-> 1021\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m HTTPError(http_error_msg, response\u001b[38;5;241m=\u001b[39m\u001b[38;5;28mself\u001b[39m)\n",
+ "\u001b[0;31mHTTPError\u001b[0m: 401 Client Error: Unauthorized for url: http://127.0.0.1:899/v1/account",
+ "\nDuring handling of the above exception, another exception occurred:\n",
+ "\u001b[0;31mAppwriteException\u001b[0m Traceback (most recent call last)",
+ "Cell \u001b[0;32mIn [6], line 7\u001b[0m\n\u001b[1;32m 4\u001b[0m response \u001b[38;5;241m=\u001b[39m account\u001b[38;5;241m.\u001b[39mget()\n\u001b[1;32m 5\u001b[0m \u001b[38;5;28mprint\u001b[39m(response)\n\u001b[0;32m----> 7\u001b[0m \u001b[43mget_account\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n",
+ "Cell \u001b[0;32mIn [6], line 4\u001b[0m, in \u001b[0;36mget_account\u001b[0;34m()\u001b[0m\n\u001b[1;32m 2\u001b[0m account \u001b[38;5;241m=\u001b[39m Account(client)\n\u001b[1;32m 3\u001b[0m p(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mRunning Get Account API\u001b[39m\u001b[38;5;124m\"\u001b[39m);\n\u001b[0;32m----> 4\u001b[0m response \u001b[38;5;241m=\u001b[39m \u001b[43maccount\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mget\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 5\u001b[0m \u001b[38;5;28mprint\u001b[39m(response)\n",
+ "File \u001b[0;32m~/.local/lib/python3.11/site-packages/appwrite/services/account.py:16\u001b[0m, in \u001b[0;36mAccount.get\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 13\u001b[0m path \u001b[38;5;241m=\u001b[39m \u001b[38;5;124m'\u001b[39m\u001b[38;5;124m/account\u001b[39m\u001b[38;5;124m'\u001b[39m\n\u001b[1;32m 14\u001b[0m params \u001b[38;5;241m=\u001b[39m {}\n\u001b[0;32m---> 16\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mclient\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcall\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43mget\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mpath\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43m{\u001b[49m\n\u001b[1;32m 17\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43mcontent-type\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43mapplication/json\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m,\u001b[49m\n\u001b[1;32m 18\u001b[0m \u001b[43m\u001b[49m\u001b[43m}\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mparams\u001b[49m\u001b[43m)\u001b[49m\n",
+ "File \u001b[0;32m~/.local/lib/python3.11/site-packages/appwrite/client.py:142\u001b[0m, in \u001b[0;36mClient.call\u001b[0;34m(self, method, path, headers, params)\u001b[0m\n\u001b[1;32m 140\u001b[0m content_type \u001b[38;5;241m=\u001b[39m response\u001b[38;5;241m.\u001b[39mheaders[\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mContent-Type\u001b[39m\u001b[38;5;124m'\u001b[39m]\n\u001b[1;32m 141\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m content_type\u001b[38;5;241m.\u001b[39mstartswith(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mapplication/json\u001b[39m\u001b[38;5;124m'\u001b[39m):\n\u001b[0;32m--> 142\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m AppwriteException(response\u001b[38;5;241m.\u001b[39mjson()[\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mmessage\u001b[39m\u001b[38;5;124m'\u001b[39m], response\u001b[38;5;241m.\u001b[39mstatus_code, response\u001b[38;5;241m.\u001b[39mjson()\u001b[38;5;241m.\u001b[39mget(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mtype\u001b[39m\u001b[38;5;124m'\u001b[39m), response\u001b[38;5;241m.\u001b[39mjson())\n\u001b[1;32m 143\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m 144\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m AppwriteException(response\u001b[38;5;241m.\u001b[39mtext, response\u001b[38;5;241m.\u001b[39mstatus_code)\n",
+ "\u001b[0;31mAppwriteException\u001b[0m: app.63c39409d6a8a5cd05bd@service.127.0.0.1 (role: applications) missing scope (account)"
+ ]
+ }
+ ],
+ "source": [
+ "def get_account():\n",
+ " account = Account(client)\n",
+ " p(\"Running Get Account API\");\n",
+ " response = account.get()\n",
+ " print(response)\n",
+ " \n",
+ "get_account()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "id": "4e7d58dc",
+ "metadata": {
+ "ExecuteTime": {
+ "end_time": "2023-03-01T13:56:54.865497Z",
+ "start_time": "2023-03-01T13:56:54.827425Z"
+ }
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "\u001b[32;1mRunning Add Document API\u001b[0m\n",
+ "{'name': 'Spider Man', 'release_year': 1920, 'rating': 98.5, 'kids': False, '$id': '63ff59a6cd9f3343eebe', '$permissions': ['read(\"users\")', 'update(\"users\")', 'delete(\"users\")'], '$createdAt': '2023-03-01T13:56:54.842+00:00', '$updatedAt': '2023-03-01T13:56:54.842+00:00', 'email': None, '$collectionId': '63ff594cd836f0e980b6', '$databaseId': '63ff5933737f37fc287b'}\n"
+ ]
+ }
+ ],
+ "source": [
+ "def add_doc():\n",
+ " global document_id\n",
+ "\n",
+ " p(\"Running Add Document API\")\n",
+ " response = databases.create_document(\n",
+ " database_id,\n",
+ " collection_id,\n",
+ " document_id=ID.unique(),\n",
+ " data={\n",
+ " 'name': \"Spider Man\",\n",
+ " 'release_year': 1920,\n",
+ " 'rating': 98.5,\n",
+ " 'kids': False\n",
+ " },\n",
+ " permissions=[\n",
+ " Permission.read(Role.users()),\n",
+ " Permission.update(Role.users()),\n",
+ " Permission.delete(Role.users()),\n",
+ " ]\n",
+ " )\n",
+ " document_id = response['$id']\n",
+ " print(response)\n",
+ " \n",
+ "add_doc()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "id": "67afe388",
+ "metadata": {
+ "ExecuteTime": {
+ "end_time": "2023-03-01T13:57:06.039997Z",
+ "start_time": "2023-03-01T13:57:06.020735Z"
+ }
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "\u001b[32;1mRunning List Document API\u001b[0m\n",
+ "{'total': 1, 'documents': [{'name': 'Spider Man', 'release_year': 1920, 'rating': 98.5, 'kids': False, 'email': None, '$id': '63ff59a6cd9f3343eebe', '$createdAt': '2023-03-01T13:56:54.842+00:00', '$updatedAt': '2023-03-01T13:56:54.842+00:00', '$permissions': ['read(\"users\")', 'update(\"users\")', 'delete(\"users\")'], '$collectionId': '63ff594cd836f0e980b6', '$databaseId': '63ff5933737f37fc287b'}]}\n"
+ ]
+ }
+ ],
+ "source": [
+ "def list_doc():\n",
+ " p(\"Running List Document API\")\n",
+ " response = databases.list_documents(\n",
+ " database_id,\n",
+ " collection_id\n",
+ " )\n",
+ " print(response)\n",
+ " \n",
+ "list_doc()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "id": "e2aa70a5",
+ "metadata": {
+ "ExecuteTime": {
+ "end_time": "2023-03-01T13:57:23.285960Z",
+ "start_time": "2023-03-01T13:57:23.237580Z"
+ }
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "\u001b[32;1mRunning Delete Database API\u001b[0m\n",
+ "b''\n"
+ ]
+ }
+ ],
+ "source": [
+ "def delete_doc():\n",
+ " p(\"Running Delete Database API\")\n",
+ " response = databases.delete_document(\n",
+ " database_id,\n",
+ " collection_id,\n",
+ " document_id\n",
+ " )\n",
+ " print(response)\n",
+ "\n",
+ "delete_doc()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "id": "29b2de8e",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "def delete_collection():\n",
+ " p(\"Running Delete Collection API\")\n",
+ " response = databases.delete_collection(\n",
+ " database_id,\n",
+ " collection_id\n",
+ " )\n",
+ " print(response)\n",
+ "\n",
+ "delete_collection()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "id": "f750b7f0",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "def delete_database():\n",
+ " p(\"Running Delete Database API\")\n",
+ " response = databases.delete(database_id)\n",
+ " print(response)\n",
+ "\n",
+ "delete_database()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "id": "cc67d97b",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "def create_bucket():\n",
+ " global bucket_id\n",
+ "\n",
+ " p(\"Running Create Bucket API\")\n",
+ " response = storage.create_bucket(\n",
+ " bucket_id=ID.unique(),\n",
+ " name='awesome bucket',\n",
+ " file_security=True,\n",
+ " permissions=[\n",
+ " Permission.read(Role.any()),\n",
+ " Permission.create(Role.users()),\n",
+ " Permission.update(Role.users()),\n",
+ " Permission.delete(Role.users()),\n",
+ " ]\n",
+ " )\n",
+ " bucket_id = response['$id']\n",
+ " print(response)\n",
+ "\n",
+ "create_bucket()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "id": "ef6b588b",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "def list_buckets():\n",
+ " p(\"Running List Buckets API\")\n",
+ " response = storage.list_buckets()\n",
+ " print(response)\n",
+ "\n",
+ "list_buckets()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "id": "6dea2764",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "def upload_file():\n",
+ " global file_id\n",
+ "\n",
+ " p(\"Running Upload File API\")\n",
+ " response = storage.create_file(\n",
+ " bucket_id,\n",
+ " file_id=ID.unique(),\n",
+ " file=InputFile.from_path(\"./resources/nature.jpg\"),\n",
+ " )\n",
+ " file_id = response['$id']\n",
+ " print(response)\n",
+ " \n",
+ "upload_file()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "id": "d458be2d",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "def list_files():\n",
+ " p(\"Running List Files API\")\n",
+ " response = storage.list_files(bucket_id)\n",
+ " print(response)\n",
+ " \n",
+ "list_files()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "id": "00cf457e",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "def delete_file():\n",
+ " p(\"Running Delete File API\")\n",
+ " response = storage.delete_file(bucket_id, file_id)\n",
+ " print(response)\n",
+ " \n",
+ "delete_file()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "id": "5666ca95",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "def delete_bucket():\n",
+ " p(\"Running Delete Bucket API\")\n",
+ " response = storage.delete_bucket(bucket_id)\n",
+ " print(response)\n",
+ " \n",
+ "delete_bucket()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "id": "cadc603b",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "def create_user():\n",
+ " global user_id\n",
+ "\n",
+ " name = str(randrange(1, maxsize))\n",
+ " p(\"Running Create User API\")\n",
+ " response = users.create(\n",
+ " user_id=ID.unique(),\n",
+ " email=f'{name}@test.com',\n",
+ " password=f'{name}@123',\n",
+ " name=name\n",
+ " )\n",
+ " user_id = response['$id']\n",
+ " print(response)\n",
+ " \n",
+ "create_user()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "id": "9a08ef0c",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "def list_user():\n",
+ " p(\"Running List User API\")\n",
+ " response = users.list()\n",
+ " print(response)\n",
+ " \n",
+ "list_user()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "id": "08cc320b",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "def delete_user():\n",
+ " p(\"Running Delete User API\")\n",
+ " response = users.delete(user_id)\n",
+ " print(response)\n",
+ " \n",
+ "delete_user()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "id": "2797a2e4",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "def create_function():\n",
+ " global function_id\n",
+ "\n",
+ " p(\"Running Create Function API\")\n",
+ " response = functions.create(\n",
+ " function_id=ID.unique(),\n",
+ " name='Test Function',\n",
+ " execute=[Role.any()],\n",
+ " runtime='python-3.9',\n",
+ " )\n",
+ " function_id = response['$id']\n",
+ " print(response)\n",
+ " \n",
+ "create_function()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "id": "23b175e1",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "def list_function():\n",
+ " p(\"Running List Function API\")\n",
+ " response = functions.list()\n",
+ " print(response)\n",
+ " \n",
+ "list_function()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "id": "939ae95d",
+ "metadata": {
+ "ExecuteTime": {
+ "end_time": "2023-03-01T12:17:09.424380Z",
+ "start_time": "2023-03-01T12:17:09.420016Z"
+ }
+ },
+ "outputs": [],
+ "source": [
+ "def delete_function():\n",
+ " p(\"Running Delete Function API\")\n",
+ " response = functions.delete(function_id)\n",
+ " print(response)\n",
+ " \n",
+ "delete_function()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "id": "225e21f4",
+ "metadata": {},
+ "outputs": [],
+ "source": []
+ },
+ {
+ "cell_type": "markdown",
+ "id": "fc3337f0",
+ "metadata": {},
+ "source": [
+ "# Test All Functionalities"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "id": "45b3995d",
+ "metadata": {
+ "ExecuteTime": {
+ "end_time": "2023-03-01T11:58:46.486872Z",
+ "start_time": "2023-03-01T11:58:43.618356Z"
+ }
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "\u001b[32;1mRunning Create Database API\u001b[0m\n",
+ "{'$id': '63ff3df39edaa0b3d980', 'name': 'Movies', '$createdAt': '2023-03-01T11:58:43.650+00:00', '$updatedAt': '2023-03-01T11:58:43.650+00:00'}\n",
+ "\u001b[32;1mRunning Create Collection API\u001b[0m\n",
+ "{'$id': '63ff3df3af7928bc6e9c', '$createdAt': '2023-03-01T11:58:43.720+00:00', '$updatedAt': '2023-03-01T11:58:43.720+00:00', '$permissions': ['read(\"any\")', 'create(\"users\")', 'update(\"users\")', 'delete(\"users\")'], 'databaseId': '63ff3df39edaa0b3d980', 'name': 'Movies', 'enabled': True, 'documentSecurity': True, 'attributes': [], 'indexes': []}\n",
+ "{'key': 'name', 'type': 'string', 'status': 'processing', 'required': True, 'array': False, 'size': 255, 'default': None}\n",
+ "{'key': 'release_year', 'type': 'integer', 'status': 'processing', 'required': True, 'array': False, 'min': 0, 'max': 9999, 'default': None}\n",
+ "{'key': 'rating', 'type': 'double', 'status': 'processing', 'required': True, 'array': False, 'min': 0, 'max': 99.99, 'default': None}\n",
+ "{'key': 'kids', 'type': 'boolean', 'status': 'processing', 'required': True, 'array': False, 'default': None}\n",
+ "{'key': 'email', 'type': 'string', 'status': 'processing', 'required': False, 'array': False, 'format': 'email', 'default': None}\n",
+ "{'key': 'name_email_idx', 'type': 'fulltext', 'status': 'processing', 'attributes': ['name', 'email'], 'orders': []}\n",
+ "\u001b[32;1mRunning List Collection API\u001b[0m\n",
+ "{'total': 1, 'collections': [{'$id': '63ff3df3af7928bc6e9c', '$createdAt': '2023-03-01T11:58:43.720+00:00', '$updatedAt': '2023-03-01T11:58:43.720+00:00', '$permissions': ['read(\"any\")', 'create(\"users\")', 'update(\"users\")', 'delete(\"users\")'], 'databaseId': '63ff3df39edaa0b3d980', 'name': 'Movies', 'enabled': True, 'documentSecurity': True, 'attributes': [{'key': 'name', 'type': 'string', 'status': 'available', 'required': True, 'array': False, 'size': 255, 'default': None}, {'key': 'release_year', 'type': 'integer', 'status': 'available', 'required': True, 'array': False, 'min': 0, 'max': 9999, 'default': None}, {'key': 'rating', 'type': 'double', 'status': 'available', 'required': True, 'array': False, 'min': 0, 'max': 99.99, 'default': None}, {'key': 'kids', 'type': 'boolean', 'status': 'available', 'required': True, 'array': False, 'default': None}, {'key': 'email', 'type': 'string', 'status': 'available', 'required': False, 'array': False, 'format': 'email', 'default': None}], 'indexes': [{'key': 'name_email_idx', 'type': 'fulltext', 'status': 'processing', 'attributes': ['name', 'email'], 'orders': []}]}]}\n",
+ "\u001b[32;1mRunning Add Document API\u001b[0m\n",
+ "{'name': 'Spider Man', 'release_year': 1920, 'rating': 98.5, 'kids': False, '$id': '63ff3df5ddeb566e343d', '$permissions': ['read(\"users\")', 'update(\"users\")', 'delete(\"users\")'], '$createdAt': '2023-03-01T11:58:45.909+00:00', '$updatedAt': '2023-03-01T11:58:45.909+00:00', 'email': None, '$collectionId': '63ff3df3af7928bc6e9c', '$databaseId': '63ff3df39edaa0b3d980'}\n",
+ "\u001b[32;1mRunning List Document API\u001b[0m\n",
+ "{'total': 1, 'documents': [{'name': 'Spider Man', 'release_year': 1920, 'rating': 98.5, 'kids': False, 'email': None, '$id': '63ff3df5ddeb566e343d', '$createdAt': '2023-03-01T11:58:45.909+00:00', '$updatedAt': '2023-03-01T11:58:45.909+00:00', '$permissions': ['read(\"users\")', 'update(\"users\")', 'delete(\"users\")'], '$collectionId': '63ff3df3af7928bc6e9c', '$databaseId': '63ff3df39edaa0b3d980'}]}\n",
+ "\u001b[32;1mRunning Delete Database API\u001b[0m\n",
+ "b''\n",
+ "\u001b[32;1mRunning Delete Collection API\u001b[0m\n",
+ "b''\n",
+ "\u001b[32;1mRunning Delete Database API\u001b[0m\n",
+ "b''\n",
+ "\u001b[32;1mRunning Create Bucket API\u001b[0m\n",
+ "{'$id': '63ff3df6009b9549218d', '$createdAt': '2023-03-01T11:58:46.002+00:00', '$updatedAt': '2023-03-01T11:58:46.002+00:00', '$permissions': ['read(\"any\")', 'create(\"users\")', 'update(\"users\")', 'delete(\"users\")'], 'fileSecurity': True, 'name': 'awesome bucket', 'enabled': True, 'maximumFileSize': 30000000, 'allowedFileExtensions': [], 'compression': 'none', 'encryption': True, 'antivirus': True}\n",
+ "\u001b[32;1mRunning List Buckets API\u001b[0m\n",
+ "{'total': 3, 'buckets': [{'$id': '63c42fc7c4a42fbec18b', '$createdAt': '2023-01-15T16:54:31.805+00:00', '$updatedAt': '2023-01-15T16:54:31.805+00:00', '$permissions': [], 'fileSecurity': False, 'name': 'newbkt', 'enabled': True, 'maximumFileSize': 30000000, 'allowedFileExtensions': [], 'compression': 'none', 'encryption': True, 'antivirus': True}, {'$id': '63ff3d45955fc481034a', '$createdAt': '2023-03-01T11:55:49.613+00:00', '$updatedAt': '2023-03-01T11:55:49.613+00:00', '$permissions': ['read(\"any\")', 'create(\"users\")', 'update(\"users\")', 'delete(\"users\")'], 'fileSecurity': True, 'name': 'awesome bucket', 'enabled': True, 'maximumFileSize': 30000000, 'allowedFileExtensions': [], 'compression': 'none', 'encryption': True, 'antivirus': True}, {'$id': '63ff3df6009b9549218d', '$createdAt': '2023-03-01T11:58:46.002+00:00', '$updatedAt': '2023-03-01T11:58:46.002+00:00', '$permissions': ['read(\"any\")', 'create(\"users\")', 'update(\"users\")', 'delete(\"users\")'], 'fileSecurity': True, 'name': 'awesome bucket', 'enabled': True, 'maximumFileSize': 30000000, 'allowedFileExtensions': [], 'compression': 'none', 'encryption': True, 'antivirus': True}]}\n",
+ "\u001b[32;1mRunning Upload File API\u001b[0m\n",
+ "{'$id': '63ff3df61d59ba2a62c2', 'bucketId': '63ff3df6009b9549218d', '$createdAt': '2023-03-01T11:58:46.126+00:00', '$updatedAt': '2023-03-01T11:58:46.126+00:00', '$permissions': [], 'name': 'nature.jpg', 'signature': '3f0f3173e56f4b8ad0f41d12ffa43d7d', 'mimeType': 'image/jpeg', 'sizeOriginal': 71325, 'chunksTotal': 1, 'chunksUploaded': 1}\n",
+ "\u001b[32;1mRunning List Files API\u001b[0m\n",
+ "{'total': 1, 'files': [{'$id': '63ff3df61d59ba2a62c2', 'bucketId': '63ff3df6009b9549218d', '$createdAt': '2023-03-01T11:58:46.126+00:00', '$updatedAt': '2023-03-01T11:58:46.126+00:00', '$permissions': [], 'name': 'nature.jpg', 'signature': '3f0f3173e56f4b8ad0f41d12ffa43d7d', 'mimeType': 'image/jpeg', 'sizeOriginal': 71325, 'chunksTotal': 1, 'chunksUploaded': 1}]}\n",
+ "\u001b[32;1mRunning Delete File API\u001b[0m\n",
+ "b''\n",
+ "\u001b[32;1mRunning Delete Bucket API\u001b[0m\n",
+ "b''\n",
+ "\u001b[32;1mRunning Create User API\u001b[0m\n",
+ "{'$id': '63ff3df62e8add94a0c0', '$createdAt': '2023-03-01T11:58:46.384+00:00', '$updatedAt': '2023-03-01T11:58:46.384+00:00', 'name': '5975016752265055906', 'password': '$argon2id$v=19$m=65536,t=4,p=3$V0pQZE5ackN1cHBNTHIySw$V+7OeaIT48DLXKGugdthg9Wg66JqlLEVuuzcvIP/A9A', 'hash': 'argon2', 'hashOptions': {'type': 'argon2', 'memoryCost': 2048, 'timeCost': 4, 'threads': 3}, 'registration': '2023-03-01T11:58:46.384+00:00', 'status': True, 'passwordUpdate': '2023-03-01T11:58:46.384+00:00', 'email': '5975016752265055906@test.com', 'phone': '', 'emailVerification': False, 'phoneVerification': False, 'prefs': {}}\n",
+ "\u001b[32;1mRunning List User API\u001b[0m\n",
+ "{'total': 3, 'users': [{'$id': 'dfgdfgdfgd123123g', '$createdAt': '2023-01-15T06:27:32.107+00:00', '$updatedAt': '2023-01-15T14:01:53.768+00:00', 'name': 'My Name', 'password': '$argon2id$v=19$m=65536,t=4,p=3$M1JJZlRlRkpEclhHcUpzdw$Ri/CuV5+27Cs3qrmm9AIOMDn9y8yDeBwS6oyOFL7DxU', 'hash': 'argon2', 'hashOptions': {'type': 'argon2', 'memoryCost': 2048, 'timeCost': 4, 'threads': 3}, 'registration': '2023-01-15T06:27:32.106+00:00', 'status': True, 'passwordUpdate': '2023-01-15T14:01:53.768+00:00', 'email': 'hemangjoshi37a@gmail.com', 'phone': '', 'emailVerification': True, 'phoneVerification': False, 'prefs': {}}, {'$id': '63c4125b35a4e4643917', '$createdAt': '2023-01-15T14:48:59.421+00:00', '$updatedAt': '2023-01-17T07:10:38.533+00:00', 'name': 'hjhj', 'password': '$argon2id$v=19$m=65536,t=4,p=3$VjM1RnVrVkIzVTEwLlhUQg$edOPHQgnF5NOWh2unoWWey7s7OJT1TEFYJLDY4FdGgA', 'hash': 'argon2', 'hashOptions': {'type': 'argon2', 'memoryCost': 2048, 'timeCost': 4, 'threads': 3}, 'registration': '2023-01-15T14:48:59.421+00:00', 'status': True, 'passwordUpdate': '2023-01-15T14:48:59.421+00:00', 'email': 'hemangjoshi37a2@gmail.com', 'phone': '', 'emailVerification': True, 'phoneVerification': False, 'prefs': {}}, {'$id': '63ff3df62e8add94a0c0', '$createdAt': '2023-03-01T11:58:46.384+00:00', '$updatedAt': '2023-03-01T11:58:46.384+00:00', 'name': '5975016752265055906', 'password': '$argon2id$v=19$m=65536,t=4,p=3$V0pQZE5ackN1cHBNTHIySw$V+7OeaIT48DLXKGugdthg9Wg66JqlLEVuuzcvIP/A9A', 'hash': 'argon2', 'hashOptions': {'type': 'argon2', 'memoryCost': 2048, 'timeCost': 4, 'threads': 3}, 'registration': '2023-03-01T11:58:46.384+00:00', 'status': True, 'passwordUpdate': '2023-03-01T11:58:46.384+00:00', 'email': '5975016752265055906@test.com', 'phone': '', 'emailVerification': False, 'phoneVerification': False, 'prefs': {}}]}\n",
+ "\u001b[32;1mRunning Delete User API\u001b[0m\n",
+ "b''\n",
+ "\u001b[32;1mRunning Create Function API\u001b[0m\n",
+ "{'$id': '63ff3df66c6742d9b776', '$createdAt': '2023-03-01T11:58:46.444+00:00', '$updatedAt': '2023-03-01T11:58:46.444+00:00', 'execute': ['any'], 'name': 'Test Function', 'enabled': True, 'runtime': 'python-3.9', 'deployment': '', 'vars': [], 'events': [], 'schedule': '', 'scheduleNext': '', 'schedulePrevious': '', 'timeout': 15}\n",
+ "\u001b[32;1mRunning List Function API\u001b[0m\n",
+ "{'total': 2, 'functions': [{'$id': '63c42f820a942f32131f', '$createdAt': '2023-01-15T16:53:22.043+00:00', '$updatedAt': '2023-01-15T16:53:22.043+00:00', 'execute': ['any'], 'name': 'pytest', 'enabled': True, 'runtime': 'python-3.9', 'deployment': '', 'vars': [], 'events': ['users.*.sessions.*.create'], 'schedule': '', 'scheduleNext': '', 'schedulePrevious': '', 'timeout': 15}, {'$id': '63ff3df66c6742d9b776', '$createdAt': '2023-03-01T11:58:46.444+00:00', '$updatedAt': '2023-03-01T11:58:46.444+00:00', 'execute': ['any'], 'name': 'Test Function', 'enabled': True, 'runtime': 'python-3.9', 'deployment': '', 'vars': [], 'events': [], 'schedule': '', 'scheduleNext': '', 'schedulePrevious': '', 'timeout': 15}]}\n",
+ "\u001b[32;1mRunning Delete Function API\u001b[0m\n",
+ "b''\n",
+ "\u001b[32;1mSuccessfully ran playground!\u001b[0m\n"
+ ]
+ }
+ ],
+ "source": [
+ "def run_all_tasks():\n",
+ "\n",
+ " # Databases\n",
+ " create_database()\n",
+ " create_collection()\n",
+ " list_collections()\n",
+ " add_doc()\n",
+ " list_doc()\n",
+ " delete_doc()\n",
+ " delete_collection()\n",
+ " delete_database()\n",
+ "\n",
+ " # Storage\n",
+ " create_bucket()\n",
+ " list_buckets()\n",
+ " upload_file()\n",
+ " list_files()\n",
+ " delete_file()\n",
+ " delete_bucket()\n",
+ "\n",
+ " # Users\n",
+ " # get_account() # Use this only with JWT\n",
+ " create_user()\n",
+ " list_user()\n",
+ " delete_user()\n",
+ "\n",
+ " # Functions\n",
+ " create_function()\n",
+ " list_function()\n",
+ " delete_function()\n",
+ "\n",
+ "if __name__ == \"__main__\":\n",
+ " run_all_tasks()\n",
+ " p(\"Successfully ran playground!\")"
+ ]
+ }
+ ],
+ "metadata": {
+ "hide_input": false,
+ "kernelspec": {
+ "display_name": "Python 3.11",
+ "language": "python",
+ "name": "python3.11"
+ },
+ "language_info": {
+ "codemirror_mode": {
+ "name": "ipython",
+ "version": 3
+ },
+ "file_extension": ".py",
+ "mimetype": "text/x-python",
+ "name": "python",
+ "nbconvert_exporter": "python",
+ "pygments_lexer": "ipython3",
+ "version": "3.11.1"
+ },
+ "toc": {
+ "base_numbering": 1,
+ "nav_menu": {},
+ "number_sections": true,
+ "sideBar": false,
+ "skip_h1_title": false,
+ "title_cell": "Table of Contents",
+ "title_sidebar": "Contents",
+ "toc_cell": true,
+ "toc_position": {},
+ "toc_section_display": false,
+ "toc_window_display": false
+ },
+ "varInspector": {
+ "cols": {
+ "lenName": 16,
+ "lenType": 16,
+ "lenVar": 40
+ },
+ "kernels_config": {
+ "python": {
+ "delete_cmd_postfix": "",
+ "delete_cmd_prefix": "del ",
+ "library": "var_list.py",
+ "varRefreshCmd": "print(var_dic_list())"
+ },
+ "r": {
+ "delete_cmd_postfix": ") ",
+ "delete_cmd_prefix": "rm(",
+ "library": "var_list.r",
+ "varRefreshCmd": "cat(var_dic_list()) "
+ }
+ },
+ "types_to_exclude": [
+ "module",
+ "function",
+ "builtin_function_or_method",
+ "instance",
+ "_Feature"
+ ],
+ "window_display": false
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 5
+}
diff --git a/playground.py b/playground.py
index 9b5b455..b00ac69 100644
--- a/playground.py
+++ b/playground.py
@@ -20,10 +20,10 @@ def p(info):
# Read the docs at https://appwrite.io/docs to get more information
# about API keys and Project IDs
client = Client()
-client.set_endpoint('http://YOUR_HOST/v1')
-client.set_project('YOUR_PROJECT_ID')
-client.set_key('YOU_API_KEY')
-client.set_self_signed()
+client.endpoint = 'http://HOSTNAME/v1'
+client.project = 'project_ID'
+client.key = 'secret_key'
+client.self_signed=False
# client.set_jwt('JWT') # Use this to authenticate with JWT instead of API_KEY
databases = Databases(client)
@@ -31,13 +31,13 @@ def p(info):
functions = Functions(client)
users = Users(client)
-database_id = None
-collection_id = None
-document_id = None
-user_id = None
-bucket_id = None
-file_id = None
-document_id = None
+database_id = 'database_id'
+collection_id = 'collection_id'
+document_id = 'document_id'
+user_id = 'user_id'
+bucket_id = 'bucket_id'
+file_id = 'file_id'
+# document_id = None
def create_database():
global database_id
@@ -323,4 +323,4 @@ def run_all_tasks():
if __name__ == "__main__":
run_all_tasks()
- p("Successfully ran playground!")
+ p("Successfully ran playground!")
\ No newline at end of file