Skip to content
Snippets Groups Projects
Commit e1fef04f authored by Rolf Niepraschk's avatar Rolf Niepraschk
Browse files

Explicit "allow_redirects=True"

parent 980b9524
No related branches found
No related tags found
No related merge requests found
......@@ -6,7 +6,7 @@ from xml.etree import ElementTree as ET
import xmlschema
import sys
from urllib.parse import urlparse
from pprint import pprint
#from pprint import pprint
# https://stackoverflow.com/questions/7160737/python-how-to-validate-a-url-in-python-malformed-or-not
def uri_validator(x):
......@@ -53,14 +53,13 @@ def get_xsd(cfg, xsd_version=None, xml_str = None):
break
if uri_validator(url):
try:
r = requests.get(url)
#pprint(vars(r))
r = requests.get(url, allow_redirects=True)
if r.url.endswith(filename): # no bad redirection
xsd_str = r.text
return r.text
else:
return False
except:
pass
return xsd_str
return False
def parse(xml_str):
try:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment