Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
# coding: utf-8
from xml.etree.ElementTree import Element, SubElement, ElementTree
import codecs
import requests
req = requests.get(
document = Element('qgsCSWConnections', {
'version': '1.0'
for el in req.json():
if 'status' in el['sync'] and el['sync']['status'] == 'successful':
child = SubElement(document, 'csw', {
'name': el['name'],
'url': el['location']
et = ElementTree(document)
with'inspire_data_gouv_fr.xml', 'w') as f:
et.write(f, encoding='utf-8', xml_declaration=True)
# Indent the file with xmllint --format inspire_data_gouv_fr.xml
<?xml version="1.0" encoding="utf-8"?>
<qgsCSWConnections version="1.0">
<csw name="GrandLyon Smart Data" url=""/>
<csw name="Géocatalogue national" url=""/>
<csw name="SIGLOIRE" url=""/>
<csw name="GéoBretagne" url=""/>
<csw name="CRIGE PACA" url=""/>
<csw name="SIG L-R" url=""/>
<csw name="Conseil Régional NPdC" url=""/>
<csw name="Sandre Eaufrance" url=""/>
<csw name="GéoPicardie" url=""/>
<csw name="GÉOPAL" url=""/>
<csw name="Cartomer" url=""/>
<csw name="CRIGEOS" url=""/>
<csw name="Ifremer Sextant" url=""/>
<csw name="GéoNormandie" url=""/>
<csw name="CRAIG" url=""/>
<csw name="GéoMayotte" url=""/>
<csw name="Corse Infogéo" url=""/>
<csw name="CIGAL" url=""/>
<csw name="GéoLimousin" url=""/>
<csw name="GéoGuyane" url=""/>
<csw name="PIGMA" url=""/>
<csw name="Géo-Centre" url=""/>
<csw name="GéoBourgogne" url=""/>
<csw name="IGN Inspire" url=""/>
<csw name="IGN GéoPortail" url=""/>
<csw name="GéoVendée" url=""/>
<csw name="Pégase Poitou-Charentes" url=""/>
<csw name="Gé" url=""/>
<csw name="atlaSanté" url=""/>
<csw name="Sigogne" url=""/>
<csw name="Géo-IDE" url=""/>
<csw name="GéoSAS" url=""/>
<csw name="Data Eaufrance" url=""/>
<csw name="DREAL Centre" url=""/>
<csw name="DREAL Champagne-Ardenne" url=""/>
<csw name="Observatoire Régional de l'Environnement du Poitou-Charentes" url=""/>
<csw name="DREAL Corse" url=""/>
<csw name="DREAL Franche-Comté" url=""/>
<csw name="DREAL Guadeloupe" url=""/>
<csw name="DREAL Guyane" url=""/>
<csw name="DREAL Haute Normandie" url=""/>
<csw name="DREAL Languedoc-Roussillon" url=""/>
<csw name="DREAL Limousin" url=""/>
<csw name="DREAL Lorraine" url=""/>
<csw name="DREAL Martinique" url=""/>
<csw name="DREAL Midi-Pyrénées" url=""/>
<csw name="DREAL Nord-Pas-de-Calais" url=""/>
<csw name="DREAL PACA" url=""/>
<csw name="DREAL Pays de la Loire" url=""/>
<csw name="DREAL Picardie" url=""/>
<csw name="DREAL Poitou-Charentes" url=""/>
<csw name="DREAL Réunion" url=""/>
<csw name="DREAL Rhône-Alpes" url=""/>
<csw name="DREAL Bretagne" url=""/>
<csw name="DREAL Bourgogne" url=""/>
<csw name="DREAL Basse Normandie" url=""/>
<csw name="DREAL Auvergne" url=""/>
<csw name="DREAL Aquitaine" url=""/>
<csw name="DREAL Alsace" url=""/>
<csw name="Moselle InfoGéo" url=""/>
<csw name="PRODIGE Auvergne" url=""/>
<csw name="MIPYGéo" url=""/>
<csw name="Inventaire Naturefrance" url=""/>
<csw name="Guyane SIG" url=""/>
<csw name="PEIGEO Réunion" url=""/>
<csw name="Gé" url=""/>
<csw name="Tigéo" url=""/>
<csw name="Géoportail93" url=""/>
<csw name="Ifremer Sextant (Géocatalogue)" url=""/>
<csw name="CIGAL (Géocatalogue)" url=""/>
<csw name="Catalogue Grand Poitiers" url=""/>
<csw name="" url=""/>
<csw name="SIG Picardie (PRODIGE)" url=""/>
<csw name="Carmen Picardie" url=""/>
<csw name="Agence de l'Eau Rhône Méditerranée et Corse" url=""/>
<csw name="Région Bretagne" url=""/>
<csw name="Adour-Garonne (EauFrance)" url=""/>
<csw name="GeoRIF" url=""/>
<csw name="GIP Loire Estuaire" url=""/>
<csw name="Géo-Centre (local)" url=""/>
<csw name="Créteil Open Data" url=""/>
<csw name="Plaine Centrale Open Data" url=""/>
<csw name="GEORHONEALPES (local)" url=""/>
<csw name="GéoBourgogne (local)" url=""/>
<csw name="Isogeo test" url=""/>
<csw name="PPIGE Nord-Pas-de-Calais (Géocatalogue)" url=""/>
<csw name="PPIGE Nord-Pas-de-Calais (Productions et acquisitions)" url=""/>
<csw name="Metawal (open data)" url=""/>
<csw name="Metawal" url=""/>
<csw name="GéoPicardie (moissonneurs)" url=""/>
<csw name="Parcs Nationaux de France" url=""/>
<csw name="SIGLOIRE (local)" url=""/>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment