A search with no results ends up with an "UNKNOWN FAILURE" exception
almightiest opened this issue · 2 comments
Searching for a TV Show and not finding any results is a valid API request, and should not result in a generic exception that is hard to handle along with other error scenarios.
Python Request:
t = tvdb_v4_official.TVDB(apikey, pin)
search = t.search("ASDFASDFASDF")
print(search)
Raw Request:
https://api4.thetvdb.com/v4/search?query=ASDFASDFASDF
incl header for Authorization Bearer token
Raw Response:
{'status': 'success', 'data': []}
Expected Response:
[]
Actual Response:
failed to get https://api4.thetvdb.com/v4/search?query=ASDFASDFASDF
UNKNOWN FAILURE
Suggested solutions:
- allow a response array of length 0 if the the status=success - change line ~43 from
if data and res.get...
toif hasattr(data, "__len__") and res.get...
- custom exception for empty search resultset
@pgjensen I have ticketed this issue for our developers to address.
Ticket for our internal reference: https://mediamorph.atlassian.net/browse/TVD-2745
@pgjensen and @WayneD this issue was resolved in v1.0.2 release. Let me know if you are still seeing any issues.