Some booking fixes

This commit is contained in:
Kuroshini 2019-10-11 14:29:01 +03:00
parent 0b9fd8b1dc
commit 0816a847ac
2 changed files with 3 additions and 3 deletions

View File

@ -141,7 +141,7 @@ class LastableService(AbstractBookingService):
super().check_whether_booking_available(restaurant_id, date)
url = f'{self.url}v1/restaurant/{restaurant_id}/offers'
r = requests.get(url, headers=self.get_common_headers(), proxies=self.proxies)
response = json.loads(r.content)['data']
response = json.loads(r.content).get('data')
if not status.is_success(r.status_code) or not response:
return False
self.response = response

View File

@ -35,9 +35,9 @@ class CheckWhetherBookingAvailable(generics.GenericAPIView):
response = {
'available': is_booking_available,
'type': service.service,
'type': service.service if service else None,
}
response.update({'details': service.response} if service.response else {})
response.update({'details': service.response} if service and service.response else {})
return Response(data=response, status=200)