ArangoDB-Community / pyArango

Python Driver for ArangoDB with built-in validation
https://pyarango.readthedocs.io/en/latest/
Apache License 2.0
238 stars 90 forks source link

ValueError: 'verify' argument can only be of type: bool, CA_Certificate or str #230

Open elade9977 opened 2 years ago

elade9977 commented 2 years ago

When running the Arango as docker with certificate (self-signed) I get the following error:

Traceback (most recent call last):
  File "connect.py", line 8, in <module>
    conn = Connection(arangoURL="https://my_url:8529", username="root", password="Aa123", verify='/opt/arangodb/certs/arangodb.pem')
  File "/home/ubuntu/.local/lib/python3.8/site-packages/pyArango/connection.py", line 227, in __init__
    self.reload()
  File "/home/ubuntu/.local/lib/python3.8/site-packages/pyArango/connection.py", line 296, in reload
    r = self.session.get(self.getDatabasesURL())
  File "/home/ubuntu/.local/lib/python3.8/site-packages/pyArango/connection.py", line 130, in __getattr__
    return AikidoSession.Holder(request_function, auth, max_conflict_retries=self.max_conflict_retries, verify=verify)
  File "/home/ubuntu/.local/lib/python3.8/site-packages/pyArango/connection.py", line 46, in __init__
    raise ValueError("'verify' argument can only be of type: bool, CA_Certificate or str ")
ValueError: 'verify' argument can only be of type: bool, CA_Certificate or str

After a lot of debugging I notice that line in the connection.py script at line 45 if not isinstance(verify, bool) and not isinstance(verify, CA_Certificate) and not not isinstance(verify, str) :

No matter what I put in verify variable it's just not working.

I remove the double not as following: if not isinstance(verify, bool) and not isinstance(verify, CA_Certificate) and not isinstance(verify, str) :

After that I finally got a secure connection with TLS to my ArnagoDB.

Please review this solution.

elade9977 commented 1 year ago

Added new commit - https://github.com/ArangoDB-Community/pyArango/pull/235