Prevented error when response doesn't have _items.

This commit is contained in:
2016-07-21 16:34:52 +02:00
parent f47dcd2a31
commit 011bfa9809
2 changed files with 66 additions and 1 deletions

View File

@@ -33,7 +33,7 @@ class Project(List, Find, Create, Post, Update, Delete, Replace):
response = api.get(url)
# Keep the response a dictionary, and cast it later into an object.
if response['_items']:
if response.get('_items'):
item = utils.convert_datetime(response['_items'][0])
return cls(item)
else: