0

I created an appwrite docker, and created a project and api in the docker.

I'm trying to use this python code:

from appwrite.client import Client
from appwrite.services.users import Users

client = Client()


(client
  .set_endpoint('https://localhost/v1') # Your API Endpoint
  .set_project('testwriter') # Your project ID
  .set_key('b5b793e92b7f1badf34c3ef0ebfd475418a2372306ea4094eb5efb20bdc76e283e28345801d34c441149cc796f0ea7608ff0696a2121f577ca2beada75f904a46b1293a1d57699eed9750a2f12c4daa261e73231f6479e425276e7df053305118080f8280e7462b01b45349310f7086fc90a606d0d5ff2e102d7119ff627e0d4') # Your secret API key
)

users = Users(client)

result = users.create('email@example.com', 'password')

I'm getting the following error output though and I can't figure it out, although I think it's because I need to create a ca key or something and add it to docker? Can somebody suggest the next steps?:

Traceback (most recent call last): File "/Users/vw/Library/Caches/pypoetry/virtualenvs/test-appwrite-XiyGxB_m-py3.9/lib/python3.9/site-packages/urllib3/connectionpool.py", line 699, in urlopen httplib_response = self._make_request( File "/Users/vw/Library/Caches/pypoetry/virtualenvs/test-appwrite-XiyGxB_m-py3.9/lib/python3.9/site-packages/urllib3/connectionpool.py", line 382, in _make_request self._validate_conn(conn) File "/Users/vw/Library/Caches/pypoetry/virtualenvs/test-appwrite-XiyGxB_m-py3.9/lib/python3.9/site-packages/urllib3/connectionpool.py", line 1010, in validate_conn conn.connect() File "/Users/vw/Library/Caches/pypoetry/virtualenvs/test-appwrite-XiyGxB_m-py3.9/lib/python3.9/site-packages/urllib3/connection.py", line 416, in connect self.sock = ssl_wrap_socket( File "/Users/vw/Library/Caches/pypoetry/virtualenvs/test-appwrite-XiyGxB_m-py3.9/lib/python3.9/site-packages/urllib3/util/ssl.py", line 449, in ssl_wrap_socket ssl_sock = ssl_wrap_socket_impl( File "/Users/vw/Library/Caches/pypoetry/virtualenvs/test-appwrite-XiyGxB_m-py3.9/lib/python3.9/site-packages/urllib3/util/ssl.py", line 493, in _ssl_wrap_socket_impl return ssl_context.wrap_socket(sock, server_hostname=server_hostname) File "/opt/homebrew/Cellar/python@3.9/3.9.7_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/ssl.py", line 500, in wrap_socket return self.sslsocket_class._create( File "/opt/homebrew/Cellar/python@3.9/3.9.7_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/ssl.py", line 1040, in _create self.do_handshake() File "/opt/homebrew/Cellar/python@3.9/3.9.7_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/ssl.py", line 1309, in do_handshake self._sslobj.do_handshake() ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate (_ssl.c:1129)

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/Users/vw/Library/Caches/pypoetry/virtualenvs/test-appwrite-XiyGxB_m-py3.9/lib/python3.9/site-packages/requests/adapters.py", line 439, in send resp = conn.urlopen( File "/Users/vw/Library/Caches/pypoetry/virtualenvs/test-appwrite-XiyGxB_m-py3.9/lib/python3.9/site-packages/urllib3/connectionpool.py", line 755, in urlopen retries = retries.increment( File "/Users/vw/Library/Caches/pypoetry/virtualenvs/test-appwrite-XiyGxB_m-py3.9/lib/python3.9/site-packages/urllib3/util/retry.py", line 574, in increment raise MaxRetryError(_pool, url, error or ResponseError(cause)) urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='localhost', port=443): Max retries exceeded with url: /v1/users (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate (_ssl.c:1129)')))

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/Users/vw/Library/Caches/pypoetry/virtualenvs/test-appwrite-XiyGxB_m-py3.9/lib/python3.9/site-packages/appwrite/client.py", line 79, in call response = requests.request( # call method dynamically https://stackoverflow.com/a/4246075/2299554 File "/Users/vw/Library/Caches/pypoetry/virtualenvs/test-appwrite-XiyGxB_m-py3.9/lib/python3.9/site-packages/requests/api.py", line 61, in request return session.request(method=method, url=url, **kwargs) File "/Users/vw/Library/Caches/pypoetry/virtualenvs/test-appwrite-XiyGxB_m-py3.9/lib/python3.9/site-packages/requests/sessions.py", line 542, in request resp = self.send(prep, **send_kwargs) File "/Users/vw/Library/Caches/pypoetry/virtualenvs/test-appwrite-XiyGxB_m-py3.9/lib/python3.9/site-packages/requests/sessions.py", line 655, in send r = adapter.send(request, **kwargs) File "/Users/vw/Library/Caches/pypoetry/virtualenvs/test-appwrite-XiyGxB_m-py3.9/lib/python3.9/site-packages/requests/adapters.py", line 514, in send raise SSLError(e, request=request) requests.exceptions.SSLError: HTTPSConnectionPool(host='localhost', port=443): Max retries exceeded with url: /v1/users (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate (_ssl.c:1129)')))

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/Users/vw/DEV/python/test-appwrite/test_appwrite/run.py", line 15, in result = users.create('email@example.com', 'password') File "/Users/vw/Library/Caches/pypoetry/virtualenvs/test-appwrite-XiyGxB_m-py3.9/lib/python3.9/site-packages/appwrite/services/users.py", line 52, in create return self.client.call('post', path, { File "/Users/vw/Library/Caches/pypoetry/virtualenvs/test-appwrite-XiyGxB_m-py3.9/lib/python3.9/site-packages/appwrite/client.py", line 106, in call raise AppwriteException(e)

vwdewaal
  • 975
  • 2
  • 11
  • 25

1 Answers1

1

I found how to make it work with python. Just add .set_self_signed(True) as part of the call.

vwdewaal
  • 975
  • 2
  • 11
  • 25