headers = {'Status': '302 Redirection', 'Location': location}
http_reply(data, headers=headers)
+def hack_observateur(data):
+ for x in data:
+ if x['nom'].startswith('[Observateur] '):
+ x.update({'nom': x['nom'][14:]})
+ x.update({'statut': 'O'})
+
def country_code_to_name(data, fields=[]):
res = urllib.request.urlopen('http://references.auf.org/export/pays.json')
country = json.loads(res.read().decode('utf-8'))
res = urllib.request.urlopen('http://references.auf.org/export/etablissements.json')
data = json.loads(res.read().decode('utf-8'))
data = [x for x in data if x['membre'] is True] # juste les membres
+ hack_observateur(data)
country_code_to_name(data, ['pays'])
data = json.dumps(data, indent=' ')
http_reply(data, mime_type='application/json')