Hi, I'm trying to use the API and it seems that in some circumstances I get this error when trying to get a label:
File "/home/ubuntu/.local/lib/python3.8/site-packages/todoist/managers/labels.py", line 72, in get
if obj.get("label"):
AttributeError: 'str' object has no attribute 'get'
The code part in question is the following:
def get(self, label_id):
"""
Gets an existing label.
"""
params = {"token": self.token, "label_id": label_id}
obj = self.api._get("labels/get", params=params)
if obj and "error" in obj:
return None
data = {"labels": []}
if obj.get("label"):
data["labels"].append(obj.get("label"))
self.api._update_state(data)
return obj
The problematic line is this:
Seems like in some situations the obj returned from self.api._get is a string object?
Kind of weird, anyway this causes an exception and obviously doesn't return the label
Update:
Seems like it only happens when I'm trying to access labels concurrently
Update 2:
Managed to solve it for my case for now by avoiding concurrently accessing labels, I didn't check if it happens when trying to access the same label or 2 labels in parallel in general.