CB Python 3.2.7 get_and_lock fails with 'GetOptions' object has no attribute 'total_seconds'

Platform: Linux
Python: 3.9+
Couchbase Python SDK: 3.2.6/3.2.7

When I try to lock an existing record to do an update, this error is thrown 100% of the time:

In Call:

query_result = await collection.get_and_lock(
str(key),
GetOptions(timeout=timedelta(seconds=self.COUCHBASEDB_TIMEOUTS)),
)

AttributeError: ‘GetOptions’ object has no attribute ‘total_seconds’

2022-04-04 12:21:14,247 | INFO | File “/redacted_path/venv/lib/python3.9/site-packages/couchbase/collection.py”, line 293, in wrapped
2022-04-04 12:21:14,248 | INFO | return func(self, *args, **kwargs)
2022-04-04 12:21:14,248 | INFO | File “/redacted_path/venv/lib/python3.9/site-packages/acouchbase/cluster.py”, line 169, in ret
2022-04-04 12:21:14,248 | INFO | rv = meth(self, *args, **kwargs)
2022-04-04 12:21:14,248 | INFO | File “/redacted_path/venv/lib/python3.9/site-packages/couchbase/collection.py”, line 293, in wrapped
2022-04-04 12:21:14,248 | INFO | return func(self, *args, **kwargs)
2022-04-04 12:21:14,248 | INFO | File “/redacted_path/venv/lib/python3.9/site-packages/couchbase/result.py”, line 544, in wrapped
2022-04-04 12:21:14,248 | INFO | x, options = func(*args, **kwargs)
2022-04-04 12:21:14,249 | INFO | File “/redacted_path/venv/lib/python3.9/site-packages/couchbase/collection.py”, line 562, in get_and_lock
2022-04-04 12:21:14,249 | INFO | return ResultPrecursor(CoreClient.lock(self.bucket, key, int(expiry.total_seconds()), **final_options),
2022-04-04 12:21:14,249 | INFO | AttributeError: ‘GetOptions’ object has no attribute ‘total_seconds’

Hi @rwdim - I apologize for the horrible response time. To answer the query though, the get_and_lock method is like the other methods in the Expiration/TTL docs (see docs here) in that the method has two required parameters (the key and the lock time) and then options and/or kwargs can be passed in. The following would be an example.

result = collection.get_and_lock(key, timedelta(seconds=5), GetAndLockOptions(timeout=timedelta(seconds=10)))

I hope this helps.