HumanSignal / label-studio-sdk

Label Studio SDK
https://api.labelstud.io
Apache License 2.0
99 stars 61 forks source link

fix: LSDV-5564: Suppress error message on normal end of pagination #153

Closed jombooth closed 1 year ago

jombooth commented 1 year ago

Before

jo@xxc:~/Repos/label-studio-sdk$ PYTHONPATH=. python tests/test_driver.py 

--------------------------------------------
Request URL: https://app.heartex.com/api/tasks?project=34506&page=2&page_size=100&query=%7B%22filters%22%3A+null%2C+%22ordering%22%3A+%5B%5D%2C+%22selectedItems%22%3A+%7B%22all%22%3A+true%2C+%22excluded%22%3A+%5B%5D%7D%7D&fields=all&resolve_uri=True
Response status code: 404
Response content:
{
  "id": "...",
  "status_code": 404,
  "version": "1.8.3dev",
  "detail": "Invalid page.",
  "exc_info": null
}

SDK error traceback:
proj=34506 got tasks: tasks=[]

After

jo@xxc:~/Repos/label-studio-sdk$ PYTHONPATH=. python tests/test_driver.py 
proj=39570 got tasks: tasks=[{'id': 65823440, ...}, {'id': 67404521, ...}, {'id': 67404522, ...}]
jo@xxc:~/Repos/label-studio-sdk$ PYTHONPATH=. python tests/test_driver.py 
proj=34506 got tasks: tasks=[]