appwrite / sdk-for-python Goto Github PK
View Code? Open in Web Editor NEW[READ-ONLY] Official Appwrite Python SDK ๐
Home Page: https://appwrite.io
License: BSD 3-Clause "New" or "Revised" License
[READ-ONLY] Official Appwrite Python SDK ๐
Home Page: https://appwrite.io
License: BSD 3-Clause "New" or "Revised" License
The entire package should be type hinted to make it easier for developers to use it.
So I was using the appwrite python SDK and found it really difficult to figure out some things, like what type the parameters are supposed to be? I had to constantly check the documentation and examples for the simplest of things. Type hinting would help with that
createEmailSession Function not on Python.
I think we can use famous linting tools like black, flake8 and isort to keep the code style consistent and maybe we can use pre-commit
hook to make sure the format is correct before making any unnecessary commits.
In some files like here:
sdk-for-python/appwrite/client.py
Line 1 in df27804
io
in this case which can be easily detected using something like this. We can use husky as well....
We can also later on add a ci workflow to make sure lint tests pass. wdyt?
We can use pre-commit
as a dev dependency and create a .pre-commit-config.yaml file in the root dir like this:
repos:
- repo: https://github.com/psf/black
rev: 23.3.0
hooks:
- id: black
language_version: python3
args: [appwrite]
- repo: https://github.com/pycqa/flake8
rev: 5.0.4
hooks:
- id: flake8
args:
- "--max-line-length=120"
- repo: https://github.com/pycqa/isort
rev: 5.11.5
hooks:
- id: isort
name: isort (python)
args: [--filter-files]
I run code :
users = Users(client)
result = users.create('uiduid123', '[email protected]', 'password')
print(result)
it gives me this error :
---------------------------------------------------------------------------
gaierror Traceback (most recent call last)
File /usr/lib/python3/dist-packages/urllib3/connection.py:174, in HTTPConnection._new_conn(self)
173 try:
--> 174 conn = connection.create_connection(
175 (self._dns_host, self.port), self.timeout, **extra_kw
176 )
178 except SocketTimeout:
File /usr/lib/python3/dist-packages/urllib3/util/connection.py:73, in create_connection(address, timeout, source_address, socket_options)
69 return six.raise_from(
70 LocationParseError("'%s', label empty or too long" % host), None
71 )
---> 73 for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
74 af, socktype, proto, canonname, sa = res
File /usr/lib/python3.11/socket.py:962, in getaddrinfo(host, port, family, type, proto, flags)
961 addrlist = []
--> 962 for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
963 af, socktype, proto, canonname, sa = res
gaierror: [Errno -2] Name or service not known
During handling of the above exception, another exception occurred:
NewConnectionError Traceback (most recent call last)
File /usr/lib/python3/dist-packages/urllib3/connectionpool.py:704, in HTTPConnectionPool.urlopen(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, body_pos, **response_kw)
703 # Make the request on the httplib connection object.
--> 704 httplib_response = self._make_request(
705 conn,
706 method,
707 url,
708 timeout=timeout_obj,
709 body=body,
710 headers=headers,
711 chunked=chunked,
712 )
714 # If we're going to release the connection in ``finally:``, then
715 # the response doesn't need to know about the connection. Otherwise
716 # it will also try to release it and we'll have a double-release
717 # mess.
File /usr/lib/python3/dist-packages/urllib3/connectionpool.py:387, in HTTPConnectionPool._make_request(self, conn, method, url, timeout, chunked, **httplib_request_kw)
386 try:
--> 387 self._validate_conn(conn)
388 except (SocketTimeout, BaseSSLError) as e:
389 # Py2 raises this as a BaseSSLError, Py3 raises it as socket timeout.
File /usr/lib/python3/dist-packages/urllib3/connectionpool.py:1045, in HTTPSConnectionPool._validate_conn(self, conn)
1044 if not getattr(conn, "sock", None): # AppEngine might not have `.sock`
-> 1045 conn.connect()
1047 if not conn.is_verified:
File /usr/lib/python3/dist-packages/urllib3/connection.py:358, in HTTPSConnection.connect(self)
356 def connect(self):
357 # Add certificate verification
--> 358 self.sock = conn = self._new_conn()
359 hostname = self.host
File /usr/lib/python3/dist-packages/urllib3/connection.py:186, in HTTPConnection._new_conn(self)
185 except SocketError as e:
--> 186 raise NewConnectionError(
187 self, "Failed to establish a new connection: %s" % e
188 )
190 return conn
NewConnectionError: <urllib3.connection.HTTPSConnection object at 0x7ff0702756d0>: Failed to establish a new connection: [Errno -2] Name or service not known
During handling of the above exception, another exception occurred:
MaxRetryError Traceback (most recent call last)
File /usr/lib/python3/dist-packages/requests/adapters.py:489, in HTTPAdapter.send(self, request, stream, timeout, verify, cert, proxies)
488 if not chunked:
--> 489 resp = conn.urlopen(
490 method=request.method,
491 url=url,
492 body=request.body,
493 headers=request.headers,
494 redirect=False,
495 assert_same_host=False,
496 preload_content=False,
497 decode_content=False,
498 retries=self.max_retries,
499 timeout=timeout,
500 )
502 # Send the request.
503 else:
File /usr/lib/python3/dist-packages/urllib3/connectionpool.py:788, in HTTPConnectionPool.urlopen(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, body_pos, **response_kw)
786 e = ProtocolError("Connection aborted.", e)
--> 788 retries = retries.increment(
789 method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2]
790 )
791 retries.sleep()
File /usr/lib/python3/dist-packages/urllib3/util/retry.py:592, in Retry.increment(self, method, url, response, error, _pool, _stacktrace)
591 if new_retry.is_exhausted():
--> 592 raise MaxRetryError(_pool, url, error or ResponseError(cause))
594 log.debug("Incremented Retry for (url='%s'): %r", url, new_retry)
MaxRetryError: HTTPSConnectionPool(host='hostname', port=443): Max retries exceeded with url: /v1/users (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7ff0702756d0>: Failed to establish a new connection: [Errno -2] Name or service not known'))
During handling of the above exception, another exception occurred:
ConnectionError Traceback (most recent call last)
File ~/.local/lib/python3.11/site-packages/appwrite/client.py:86, in Client.call(self, method, path, headers, params)
85 try:
---> 86 response = requests.request( # call method dynamically https://stackoverflow.com/a/4246075/2299554
87 method=method,
88 url=self._endpoint + path,
89 params=self.flatten(params, stringify=stringify),
90 data=self.flatten(data),
91 json=json,
92 files=files,
93 headers=headers,
94 verify=(not self._self_signed),
95 )
97 response.raise_for_status()
File /usr/lib/python3/dist-packages/requests/api.py:59, in request(method, url, **kwargs)
58 with sessions.Session() as session:
---> 59 return session.request(method=method, url=url, **kwargs)
File /usr/lib/python3/dist-packages/requests/sessions.py:587, in Session.request(self, method, url, params, data, headers, cookies, files, auth, timeout, allow_redirects, proxies, hooks, stream, verify, cert, json)
586 send_kwargs.update(settings)
--> 587 resp = self.send(prep, **send_kwargs)
589 return resp
File /usr/lib/python3/dist-packages/requests/sessions.py:701, in Session.send(self, request, **kwargs)
700 # Send the request
--> 701 r = adapter.send(request, **kwargs)
703 # Total elapsed time of the request (approximately)
File /usr/lib/python3/dist-packages/requests/adapters.py:565, in HTTPAdapter.send(self, request, stream, timeout, verify, cert, proxies)
563 raise SSLError(e, request=request)
--> 565 raise ConnectionError(e, request=request)
567 except ClosedPoolError as e:
ConnectionError: HTTPSConnectionPool(host='hostname', port=443): Max retries exceeded with url: /v1/users (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7ff0702756d0>: Failed to establish a new connection: [Errno -2] Name or service not known'))
During handling of the above exception, another exception occurred:
AppwriteException Traceback (most recent call last)
Cell In [4], line 2
1 users = Users(client)
----> 2 result = users.create('uiduid123', '[email protected]', 'password')
3 result
File ~/.local/lib/python3.11/site-packages/appwrite/services/users.py:39, in Users.create(self, user_id, email, phone, password, name)
36 params['password'] = password
37 params['name'] = name
---> 39 return self.client.call('post', path, {
40 'content-type': 'application/json',
41 }, params)
File ~/.local/lib/python3.11/site-packages/appwrite/client.py:113, in Client.call(self, method, path, headers, params)
111 raise AppwriteException(response.text, response.status_code)
112 else:
--> 113 raise AppwriteException(e)
AppwriteException: HTTPSConnectionPool(host='hostname', port=443): Max retries exceeded with url: /v1/users (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7ff0702756d0>: Failed to establish a new connection: [Errno -2] Name or service not known'))
should make a new user
not making a new user
Version 0.10.x
Linux
no customization. verything standard and as latest as it can get.
Python SDK should implement all the console endpoints as described in the Console API spec.
I noticed there is a project called an SDK generator (https://github.com/appwrite/sdk-generator). How close do you see it as being functional? I would be happy to work on updating this Python SDK, but in case the generator is being implemented in the next version, there is no need to work on this SDK manually.
At the moment, we are looking for example:
Doing these via the API allows all the console activities to be performed automatically (such as provisioning a new instance). These API endpoints exists already and there is no reason they wouldn't be included in the SDK's.
We can optimize the performance of the SDK by making it compatible to run in an asynchronous manner.
I have a few ideas about where to start. If this aligns with your current goal then I would be happy to contribute.
My code to get doclist :
DocumentList doclist = await dbs.listDocuments(
databaseId: databaseIdTeletest,
collectionId: this.channelURLtoCollectioIDconverter(),
queries: [
Query.limit(limitCountMessages),
// Query.orderAsc('attribute'),
Query.orderDesc('messageTimeStr'),
]);
When I run this without Query.orderDesc('messageTimeStr')
the this line returns expected results but when I add Query.orderDesc('messageTimeStr')
it returns null
.
Should get ordered doclist.
not getting doc list.
Version 0.10.x
Linux
Everything standard and latest.
GitHub has recently rolled out a public beta for their issue forms feature. This would allow you to create interactive issue templates and validate them ๐คฏ.
Appwrite currently uses the older issue template format. Your task is to create GitHub issue forms for this repository. Please use Appwrite's issue templates as a reference for this PR.
.github/ISSUE_TEMPLATE/bug.yaml
.github/ISSUE_TEMPLATE/documentation.yaml
.github/ISSUE_TEMPLATE/feature.yaml
If you need any help, reach out to us on our Discord server.
Are you ready to work on this issue? ๐ค Let us know, and we will assign it to you ๐
Happy Appwriting!
Traceback (most recent call last):
File "/usr/local/server/src/server.py", line 165, in handler
output = await asyncio.wait_for(execute(context), timeout=safeTimeout)
File "/usr/local/lib/python3.9/asyncio/tasks.py", line 479, in wait_for
return fut.result()
File "/usr/local/server/src/server.py", line 158, in execute
output = userModule.main(context)
File "/usr/local/server/src/function/src/main.py", line 24, in main
dataOperation.spotInfoHandle()
File "/usr/local/server/src/function/src/data_operation.py", line 24, in spotInfoHandle
Query.orderDesc("rank"),
AttributeError: type object 'Query' has no attribute 'orderDesc'
When I use the list_documents function and pass in Query.orderDesc("index_rank") as the query condition, the error occurs. I checked the implementation source code of Query and found that there was no problem, but in fact, an error was reported.
Preparing for build ...
Building ...
Collecting appwrite
Downloading appwrite-4.0.0.tar.gz (16 kB)
Preparing metadata (setup.py): started
Preparing metadata (setup.py): finished with status 'done'
I am using appwrite-4.0.0 version on the current cloud platform
Sorting queries can be used normally
Traceback (most recent call last):
File "/usr/local/server/src/server.py", line 165, in handler
output = await asyncio.wait_for(execute(context), timeout=safeTimeout)
File "/usr/local/lib/python3.9/asyncio/tasks.py", line 479, in wait_for
return fut.result()
File "/usr/local/server/src/server.py", line 158, in execute
output = userModule.main(context)
File "/usr/local/server/src/function/src/main.py", line 24, in main
dataOperation.spotInfoHandle()
File "/usr/local/server/src/function/src/data_operation.py", line 24, in spotInfoHandle
Query.orderDesc("rank"),
AttributeError: type object 'Query' has no attribute 'orderDesc'
Version 0.10.x
MacOS
No response
'Getting Started Tutorial' link in the readme section is outdated and only results in too many redirects.
The code snippet for creating a user in the getting started guide throws an error due to an invalide phone number.
This:
result = users.create('[USER_ID]', '[email protected]', 'password')
should be changed to:
result = users.create(ID.unique(), email = '[email protected]', phone = '+123456789', password = 'password', name = 'user1')
In python we don't have strict type checking like in TS but we can still add type hints which would be good for better readability and maintainability. Also we can use a famous python package called mypy to implement some strict type checking if possible; not a necessity tho :)
Like maybe something like this:
def get_image(self, url, width: float = None, height: float = None) -> Optional[str]:
PyPI package of appwrite throws error. Tried running
pip install appwrite
ERROR: Could not find a version that satisfies the requirement appwrite (from versions: none)
ERROR: No matching distribution found for appwrite
When using the SDK w/o calling client.set_self_signed()
, I get the following warning even though I have a valid certificate:
/usr/local/src/.appwrite/urllib3/connectionpool.py:1013: InsecureRequestWarning: Unverified HTTPS request is being made to host 'my.domain.com'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html#ssl-warnings
warnings.warn(
This is because of the following code:
response = requests.request( # call method dynamically https://stackoverflow.com/a/4246075/2299554
method=method,
url=self._endpoint + path,
params=self.flatten(params),
data=self.flatten(data),
json=json,
files=files,
headers=headers,
verify=self._self_signed,
)
When self._self_signed
is False
, verification isn't done.
The fix would be to pass (not self._self_signed)
to verify.
Just noticed while using the AppWrite Phyton module in a Jupyter Notebook that I get a warning:
InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
I guess would be easy to fix with this statement before urllib3
is used:
import certifi
import urllib3
http = urllib3.PoolManager(cert_reqs='CERT_REQUIRED',ca_certs=certifi.where())
Trying to perform a query like so :
users_list = database.list_documents('profiles',
[
Query.equal('open', True)
]
Error "Query type does not match expected: boolean" is raised.
It looks like the Python SDK just pass the value as "True" in the rest api call
https://domain.com/v1/database/collections/profiles/documents?queries%5B0%5D=open.equal%28True%29
converting the value to lowercase will make the query works
Bellow is the part that would probably need some love
appwrite/query.py
38 def parseValues(value):
39 if type(value) == str:
40 return '"{}"'.format(value)
41 else:
43 return value
maybe something like ?
appwrite/query.py
38 def parseValues(value):
39 if type(value) == str:
40 return '"{}"'.format(value)
39 elif type(value) == bool:
40 return '{}'.format(str(value).lower())
41 else:
43 return value
Version 0.12.x
Linux
No response
Why does the SDK uses str.replace() instead fstring?.
In the past few days I'm working on implementing the front of appwrite in python for learning purposes and I've note that the 'python server sdk' mostly uses str.replace() for its calls. increasing processing time on each call of str.replace().
So it raise the question why these calls doesn't uses fstring?, it will greatly reduce processing time.
for example from Services.Databases:
def update_document(self, database_id, collection_id, document_id, data = None, permissions = None):
"""Update Document"""
path = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'
params = {}
if database_id is None:
raise AppwriteException('Missing required parameter: "database_id"')
if collection_id is None:
raise AppwriteException('Missing required parameter: "collection_id"')
if document_id is None:
raise AppwriteException('Missing required parameter: "document_id"')
path = path.replace('{databaseId}', database_id)
path = path.replace('{collectionId}', collection_id)
path = path.replace('{documentId}', document_id)
params['data'] = data
params['permissions'] = permissions
return self.client.call('patch', path, {
'content-type': 'application/json',
}, params)
Instead it is possible to use fstring, but need to note that there is lack of compliance with python under version 3.6.
def update_document(self, database_id, collection_id, document_id, data = None, permissions = None):
"""Update Document"""
params = {}
if database_id is None:
raise AppwriteException('Missing required parameter: "database_id"')
if collection_id is None:
raise AppwriteException('Missing required parameter: "collection_id"')
if document_id is None:
raise AppwriteException('Missing required parameter: "document_id"')
# bare minimum cpu usage
path = f'/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'
params['data'] = data
params['permissions'] = permissions
return self.client.call('patch', path, {
'content-type': 'application/json',
}, params)
$ python3
>>> from appwrite.client import Client
Import the module
ModuleNotFoundError: No module named 'appwrite.client'; 'appwrite' is not a package
Different version (specify in environment)
Linux
No special installation/environment:
Debian 10
Python 3.7.3
Appwrite v:0.12.0.200
Appwrite-Python 0.6.0
Here is a full trace:
pconwell@dev:~/appwrite_py$ sudo apt update && sudo apt upgrade -y
Hit:1 http://deb.debian.org/debian buster InRelease
Hit:2 http://deb.debian.org/debian buster-updates InRelease
Hit:3 http://security.debian.org/debian-security buster/updates InRelease
Get:4 https://pkgs.tailscale.com/stable/debian buster InRelease
Fetched 5,534 B in 1s (5,022 B/s)
Reading package lists... Done
Building dependency tree
Reading state information... Done
All packages are up to date.
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
pconwell@dev:~/appwrite_py$ pip3 install appwrite
Requirement already satisfied: appwrite in /home/pconwell/.local/lib/python3.7/site-packages (0.6.0)
Requirement already satisfied: requests in /usr/local/lib/python3.7/dist-packages (from appwrite) (2.27.1)
Requirement already satisfied: certifi>=2017.4.17 in /home/pconwell/.local/lib/python3.7/site-packages (from requests->appwrite) (2020.6.20)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in /usr/local/lib/python3.7/dist-packages (from requests->appwrite) (1.26.8)
Requirement already satisfied: idna<4,>=2.5; python_version >= "3" in /usr/local/lib/python3.7/dist-packages (from requests->appwrite) (3.3)
Requirement already satisfied: charset-normalizer~=2.0.0; python_version >= "3" in /usr/local/lib/python3.7/dist-packages (from requests->appwrite) (2.0.10)
pconwell@dev:~/appwrite_py$ python3
Python 3.7.3 (default, Jan 22 2021, 20:04:44)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from appwrite.client import Client
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/pconwell/appwrite_py/appwrite.py", line 1, in <module>
from appwrite.client import Client
ModuleNotFoundError: No module named 'appwrite.client'; 'appwrite' is not a package
>>> quit()
This could absolutely be user error, but I feel like this process is pretty straightforward so I'm not sure what I would be messing up.
Help users debug python SDK calls by making errors easier to find when the user is using Appwrite's example code.
Yes.
Yes.
The python code examples provided in Appwrite documentation are great if everything is setup correctly and the request body is well-formatted. However, exceptions encountered with these examples do not display the Response body, which is useful for debugging errors.
Let's say I have a collection with two rules "testField" and "testIndex" (both required). These are the last two suggested lines from the Database - Create Document] snippet, but note that the document body leaves out a required field ("testIndex"):
...
database = Database(client)
result = database.create_document('[COLLECTION_ID]', {"testField": "asdf"}, [], [])
The output only tells us the HTTP response code, but not the reason for the error:
Traceback (most recent call last):
File "/masked_dir/populate_appwrite.py", line 94, in <module>
result = database.create_document(
File "/pip_dir/lib/python3.9/site-packages/appwrite/services/database.py", line 105, in create_document
return self.client.call('post', path, {
File "/pip_dir/lib/python3.9/site-packages/appwrite/client.py", line 81, in call
response.raise_for_status()
File "/pip_dir/lib/python3.9/site-packages/requests/models.py", line 943, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: https://{server_url}/v1/database/collections/{collection_id}/documents
The response body is available when we catch the exception, so one idea would be to add try/excepts to all example snippets:
import requests
...
database = Database(client)
try:
result = database.create_document('[COLLECTION_ID]', {"testField": "asdf"}, [], [])
except requests.exceptions.HTTPError as e:
print(e)
print(e.response.content) # Provides great debug info, but not an obvious idea to new python developers
print(e.response.json()) # If the response body is JSON, it can be easily parsed into python dicts/lists
This time, we get the
400 Client Error: Bad Request for url: https://appwrite.schnoodle.house/v1/database/collections/601904087f110/documents
b'{"message":"Bad structure. Invalid document structure: Missing required key \\"testIndex\\"","code":400,"version":"dev"}'
{'message': 'Bad structure. Invalid document structure: Missing required key "testIndex"', 'code': 400, 'version': 'dev'}
If this makes the snippets too ugly, a higher-effort solution would be to catch errors within the Appwrite SDK and raise a custom Appwrite exception that contains important response details including the body.
To get the list of documents, filtered by datetime an intuitive method would be something like this:
# get datetime before an hour
hour_ago = datetime.now()-timedelta(hours=1)
databases = Databases(client)
doclist = await databases.list_documents(
"databaseID", # database_id
"collectionID", # collection_id
[
# queries
Query.greaterThan("$updatedAt", hour_ago),
]);
But this results in an empty list. The issue I found was its because of how the value of datetime is parsed. The datetime is simply set str(datetime)
to query, but the resulting string is invalid for filtering the documents.
The way I solved this is by using the query string by myself.
# get datetime before an hour
hour_ago = datetime.utcnow()-timedelta(hours=1). # requires utc datetime
databases = Databases(client)
doclist = await databases.list_documents(
"databaseID",
"collectionID",
[
f'greaterThan("$updatedAt", ["{hour_ago.isoformat()}"])',
]);
It should result in a list with appropriately filtered documents, but it doesn't.
It either results in all of the documents or none at all depending on the filter greaterThan
or lessThan
used.
Version 0.10.x
Linux
No response
I have followed your documentation to the tee. I am using flask as my primary framework. In my python itself, I am creating a team for the currently logged-in user, but the logged-in user is not getting added as owner in the database.
When creating a file with the following code using a JWT
# Token info
token_data = jwt.decode(token, server.SECRET_KEY, algorithms=server.ALGORITHM)
print(f'JWT: {token}')
print(f'JWT: {token_data}')
# Client
client = Client().set_endpoint(ENDPOINT).set_project(PROJECT).set_jwt(token)
# Making sure token is ok
account = Account(client)
print(account.get())
# Creating a new file
storage = Storage(client)
res = storage.create_file(open('image.png', 'rb'))
The following error is thrown
[Error] Method: POST
[Error] URL: /v1/storage/files
[Error] Type: Appwrite\Database\Exception\Authorization
[Error] Message: Missing "write" permission for role "user:60bf4dfc2c7f4". Only this scopes "["*"]" are given and only this are allowed "["user:60bf4dfc2c7f4"]".
[Error] File: /usr/src/code/src/Appwrite/Database/Database.php
[Error] Line: 235
Output
JWT: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VySWQiOiI2MGJmNGRmYzJjN2Y0Iiwic2Vzc2lvbklkIjoiNjBjOGFkMmI5ZDU3ZSIsImV4cCI6MTYyMzc2NzIyNH0.r0QtMtGMs6P4CWxasR0tHQ0xdJaUA1hSnqzg9AMlnCk
JWT: {'userId': '60bf4dfc2c7f4', 'sessionId': '60c8ad2b9d57e', 'exp': 1623767224}
{'$id': '60bf4dfc2c7f4', 'name': 'Javier', 'registration': 1623150076, 'status': 0, 'passwordUpdate': 1623150076, 'email': '[email protected]', 'emailVerification': True, 'prefs': {}}
Same error when permissions are given.
res = storage.create_file(open('image.png', 'rb'), ['user:60bf4dfc2c7f4'], ['user:60bf4dfc2c7f4'])
Environment:
Install Appwrite Python sdk v5.0.1
run users.list([Query.search('email','[email protected]')]) on a users service
Return the specified user.
{'message': 'Invalid queries
param: Invalid query: Invalid query', 'code': 400, 'type': 'general_argument_invalid', 'version': '0.12.125'}
Different version (specify in environment)
Linux
Appwrite python sdk 5.0.1 fetching users from Appwrite cloud
Followed the steps in: https://appwrite.io/docs/quick-starts/python.
Ensured correct Project Id and API key.
Expected my_app to launch, connect to API / db, and return "todo" items.
my_app.py example fails to run with:
(.venv) (base) dev@dv_one: python my_app.py
Traceback (most recent call last):
File "/home/user/Documents/appwrite/test/test_python/.venv/lib/python3.9/site-packages/appwrite/client.py", line 100, in call
response.raise_for_status()
File "/home/user/Documents/appwrite/test/test_python/.venv/lib/python3.9/site-packages/requests/models.py", line 1021, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 404 Client Error: Not Found for url: https://cloud.appwrite.io/v1/databases
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/user/Documents/appwrite/test/test_python/my_app.py", line 102, in
prepare_database()
File "/home/user/Documents/appwrite/test/test_python/my_app.py", line 21, in prepare_database
todoDatabase = databases.create(
File "/home/user/Documents/appwrite/test/test_python/.venv/lib/python3.9/site-packages/appwrite/services/databases.py", line 40, in create
return self.client.call('post', api_path, {
File "/home/user/Documents/appwrite/test/test_python/.venv/lib/python3.9/site-packages/appwrite/client.py", line 112, in call
raise AppwriteException(response.json()['message'], response.status_code, response.json().get('type'), response.json())
appwrite.exception.AppwriteException: Project with the requested ID could not be found. Please check the value of the X-Appwrite-Project header to ensure the correct project ID is being used.
Version 0.10.x
Linux
Kernel 6.1.55-1-MANJARO x86_64
Python 3.9.13
AMD Ryzen 7 1700X Eight-Core Processor
I can add more details upon request.
Current documentation suggests to install via pip. Manual installation step could also be added. I can add if needed.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.