0001-lingo-return-empty-list-if-retrieving-invoice-fails-.patch
combo/apps/lingo/models.py | ||
---|---|---|
173 | 173 |
url = self.webservice_url + '/invoices/' |
174 | 174 |
if history: |
175 | 175 |
url += 'history/' |
176 |
items = requests.get(url, user=user, remote_service='auto', cache_duration=0).json() |
|
176 |
try: |
|
177 |
response = requests.get(url, user=user, remote_service='auto', cache_duration=0) |
|
178 |
response.raise_for_status() |
|
179 |
except requests.RequestException: |
|
180 |
# already logged by log errors if status != 2xx |
|
181 |
return [] |
|
182 |
items = response.json() |
|
177 | 183 |
if items.get('data'): |
178 | 184 |
return [build_remote_item(item, self) for item in items.get('data')] |
179 | 185 |
return [] |
180 |
- |