From 555016f59067b84e5f07cc33bf748a9e1e2c602f Mon Sep 17 00:00:00 2001 From: sidya82 Date: Fri, 20 Mar 2015 18:21:32 +0100 Subject: [PATCH] =?UTF-8?q?=09modifi=C3=A9=C2=A0:=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20INITBASE/loader.py?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- INITBASE/loader.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/INITBASE/loader.py b/INITBASE/loader.py index f50f1c3..e8d192d 100755 --- a/INITBASE/loader.py +++ b/INITBASE/loader.py @@ -3,7 +3,14 @@ import xml.etree.ElementTree as ET import MySQLdb as mdb import sys import re -import os +import httplib + +def exists(site, path): + conn = httplib.HTTPConnection(site) + conn.request('HEAD', path) + response = conn.getresponse() + conn.close() + return response.status == 200 def insert (cur, table, dict) : keys = "" @@ -101,8 +108,7 @@ try : image = child.text.encode('utf-8') # On s'interesee qu'aux oeuvres ayant une image - response = os.system("ping -c 1 " + "http://www.augustins.org/documents/10180/156407/"+image) - if image != "NULL" and response == 0 : + if image != "NULL" and exists('http://www.augustins.org','/documents/10180/156407/'): if str(datation)+str(datation2) in listeDatation : iddatation = listeDatation[str(datation)+str(datation2)] else :