diff --git a/Archive.py b/Archive.py index 683f50097e30750453125529319a8ec89f0d5a76..c32acb08e52394742b2844d54b6d515625643293 100644 --- a/Archive.py +++ b/Archive.py @@ -299,10 +299,17 @@ class Archive(): # The token is only valid for two hours. If your connection is slow # or if you are downloading lots of products #============================================================= + + proxyDict = { + "http" : "{0}".format(self._proxy_enabled.proxy), \ + "https" : "{0}".format(self._proxy_enabled.proxy), \ + "ftp" : "{0}".format(self._proxy_enabled.proxy) \ + } + url = "{0}/services/authenticate/".format(self.server) payload = {'ident' : "{0}".format(user_theia), 'pass' : "{0}".format(password_theia)} - reponse = requests.post(url, data=payload) + reponse = requests.post(url, data=payload, proxies=proxyDict) try: self.logger.debug(reponse.json()) @@ -322,13 +329,12 @@ class Archive(): if not os.path.exists(self.list_archive[d][1]): self.logger.info("Téléchargement : {0}".format(os.path.basename(self.list_archive[d][1]))) url = "{0}/{1}/collections/{2}/{3}/download/?issuerId=theia".format(self.server, self.resto, self._captor, self.list_archive[d][2]) - reponse = requests.get(url, headers=head) + reponse = requests.get(url, headers=head, proxies=proxyDict) with (open(self.list_archive[d][1], "wb")) as fichier : fichier.write(reponse.content) self.logger.info("All images have been downloaded !") - sys.exit(1) def decompress(self): """