diff --git a/lib/inat_vision_api.py b/lib/inat_vision_api.py index 48ee2d8..5a22e0f 100644 --- a/lib/inat_vision_api.py +++ b/lib/inat_vision_api.py @@ -243,7 +243,7 @@ def download_observation(self, observation_id, image_uuid): response = urllib.request.urlopen(url) data = json.loads(response.read()) if (data is None or data["results"] is None or len ( data["results"] ) == 0 or data["results"][0] is - None or data["results"][0]["photos"] is None or data["results"][0]["photos"][0] is + None or data["results"][0]["photos"] is None or len ( data["results"][0]["photos"] ) == 0 or data["results"][0]["photos"][0] is None or data["results"][0]["photos"][0]["url"] is None): return None, None, None, None # download the first image if it isn't already cached