-
Notifications
You must be signed in to change notification settings - Fork 73
'str' object has no attribute 'get' in labels.py #83
Comments
@rosenpin can you please provide a sample code to reproduce it? |
If it doesn't crash try running it again or with more iterations than 5 Example codefrom threading import Thread
from todoist import TodoistAPI
def test(api, labels):
for label in labels:
Thread(target=lambda: print(api.labels.get(label_id=label["id"]))).start()
def main():
api = TodoistAPI(token=YOUR_TOKEN)
api.reset_state()
api.sync()
labels = api.labels.all()
for i in range(5):
Thread(target=lambda: test(api=api, labels=labels)).start()
if __name__ == '__main__':
main() Example log:
|
I too am getting this error, only on some label requests. import todoist
api = todoist.TodoistAPI("<key>")
for item in api.items.all():
for label in item['labels']:
api.labels.get(label) |
Just want to let everyone know that we are aware of this error. It's not just something related to this library but related to some changes we are doing at the API level. The library is using an endpoint that is not publicly documented and this endpoint is already using a new format. We are discussing what will be the next steps and will fix the library as soon as we get to a conclusion. 👍 |
Having a similar issue when trying to fetch a Project using the parent_project_id of an event from the Activity API, not sure if it's the same issue or if I should open a new ticket:
I suspect it's related to completing a task inside a section inside a project |
@c99koder this is probably related to a problem we're having at the moment not exactly this issue. |
@PotHix Yes, it seems to be working again now the outage has been resolved. Thanks! |
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:
The code part in question is the following:
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.
The text was updated successfully, but these errors were encountered: