summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrédéric Péters <fpeters@entrouvert.com>2020-02-26 19:48:39 (GMT)
committerFrédéric Péters <fpeters@entrouvert.com>2020-02-26 19:48:39 (GMT)
commit8b1e820ced51392c7d2ef51b762671db0595e799 (patch)
treed2a849892ec14f264652b0adf4b7d39e58f80e74
parent6c9e0e692eb654108c352e751b7642dd82793dfa (diff)
downloadmisc-fred-8b1e820ced51392c7d2ef51b762671db0595e799.zip
misc-fred-8b1e820ced51392c7d2ef51b762671db0595e799.tar.gz
misc-fred-8b1e820ced51392c7d2ef51b762671db0595e799.tar.bz2
grandlyon: add grab-cartads-wsdl script
-rw-r--r--grandlyon/scripts/grab-cartads-wsdl.py32
1 files changed, 32 insertions, 0 deletions
diff --git a/grandlyon/scripts/grab-cartads-wsdl.py b/grandlyon/scripts/grab-cartads-wsdl.py
new file mode 100644
index 0000000..3967b74
--- /dev/null
+++ b/grandlyon/scripts/grab-cartads-wsdl.py
@@ -0,0 +1,32 @@
+#! /usr/bin/env python
+
+from StringIO import StringIO
+from lxml import etree as ET
+import requests
+import time
+
+urls = []
+for wsdl in ('ServiceDocumentation.svc', 'ServiceEtapeDossier.svc', 'ServicePortail.svc', 'ServiceSuiviNumerique.svc', 'ServiceDossier.svc', 'ServicePiece.svc', 'ServiceRechercheDossier.svc'):
+ urls.append((wsdl, 'https://api-rec.grandlyon.com/ads-rec/adscs/webservices/%s?wsdl' % wsdl))
+
+def indent_xml(elem, level=0):
+ # in-place prettyprint formatter
+ # http://effbot.org/zone/element-lib.htm#prettyprint
+ i = "\n" + level*" "
+ if len(elem):
+ if not elem.text or not elem.text.strip():
+ elem.text = i + " "
+ for elem in elem:
+ indent_xml(elem, level+1)
+ if not elem.tail or not elem.tail.strip():
+ elem.tail = i
+ else:
+ if level and (not elem.tail or not elem.tail.strip()):
+ elem.tail = i
+ return elem
+
+import_counter = 1
+
+i = 0
+while i < len(urls):
+ time.sleep(0.1)