update to match webservice changes
This commit is contained in:
parent
96c76165c6
commit
298de7e0dd
|
@ -63,21 +63,20 @@ class VoiesView(View, SingleObjectMixin):
|
|||
|
||||
result = requests.get(url, headers={'Accept': 'application/json'},
|
||||
verify=self.get_object().verify_cert).json()
|
||||
if isinstance(result['findResponse'], list):
|
||||
lisrues = result['findResponse']
|
||||
elif isinstance(result['findResponse'], dict) and 'return' in result['findResponse']:
|
||||
lisrues = [result['findResponse']['return']]
|
||||
if isinstance(result['rues'], list):
|
||||
lisrues = result['rues']
|
||||
elif isinstance(result['rues'], dict) and 'return' in result['rues']:
|
||||
lisrues = [result['rues']['return']]
|
||||
else:
|
||||
lisrues = []
|
||||
|
||||
streets = []
|
||||
for item in lisrues:
|
||||
name = item.get('particuleMinuscule') or ''
|
||||
if name and not name.endswith("'"):
|
||||
name += ' '
|
||||
name += item.get('libelleMinuscule')
|
||||
if not item.get('rue'):
|
||||
continue
|
||||
streets.append({
|
||||
'id': item.get('id'),
|
||||
'text': name})
|
||||
'id': item.get('codeRue'),
|
||||
'text': item.get('rue')
|
||||
})
|
||||
|
||||
return utils.response_for_json(request, {'data': streets})
|
||||
|
|
Loading…
Reference in New Issue