def _roads_extract(resp):
 try:
  j = resp.json()
 except:
  if (resp.status_code != 200):
   raise googlemaps.exceptions.HTTPError(resp.status_code)
  raise googlemaps.exceptions.ApiError('UNKNOWN_ERROR', 'Received a malformed response.')
 if ('error' in j):
  error = j['error']
  status = error['status']
  if (status == 'RESOURCE_EXHAUSTED'):
   raise googlemaps.exceptions._RetriableRequest()
  if ('message' in error):
   raise googlemaps.exceptions.ApiError(status, error['message'])
  else:
   raise googlemaps.exceptions.ApiError(status)
 if (resp.status_code != 200):
  raise googlemaps.exceptions.HTTPError(resp.status_code)
 return j

def _roads_extract ( resp ) : try : j = resp . json ( ) except : if ( resp . status_code != 200 ) : raise googlemaps . exceptions . HTTPError ( resp . status_code ) raise googlemaps . exceptions . ApiError ( 'UNKNOWN_ERROR' , 'Received a malformed response.' ) if ( 'error' in j ) : error = j [ 'error' ] status = error [ 'status' ] if ( status == 'RESOURCE_EXHAUSTED' ) : raise googlemaps . exceptions . _RetriableRequest ( ) if ( 'message' in error ) : raise googlemaps . exceptions . ApiError ( status , error [ 'message' ] ) else : raise googlemaps . exceptions . ApiError ( status ) if ( resp . status_code != 200 ) : raise googlemaps . exceptions . HTTPError ( resp . status_code ) return j
extracts a result from a roads api http response .