diff --git a/.coveragerc b/.coveragerc old mode 100755 new mode 100644 diff --git a/.gitignore b/.gitignore old mode 100755 new mode 100644 diff --git a/.travis.yml b/.travis.yml old mode 100755 new mode 100644 diff --git a/CHANGES.rst b/CHANGES.rst old mode 100755 new mode 100644 diff --git a/README.rst b/README.rst old mode 100755 new mode 100644 diff --git a/netdiff/info.py b/netdiff/info.py old mode 100755 new mode 100644 diff --git a/netdiff/parsers/base.py b/netdiff/parsers/base.py old mode 100755 new mode 100644 index ffdb279..37612df --- a/netdiff/parsers/base.py +++ b/netdiff/parsers/base.py @@ -49,20 +49,21 @@ def _to_python(self, data): Input data might be: * a path which points to a JSON file * a URL which points to a JSON file - (supported schemas: http, https, telnet) + (supported schemes: http, https, telnet) * a JSON formatted string * a dict representing a JSON structure """ # string if isinstance(data, six.string_types): + up = urlparse.urlparse(data) # if it looks like a file path if True in [data.startswith('./'), data.startswith('../'), data.startswith('/')]: data = open(data).read() # if it looks like a HTTP URL - elif data.startswith('http'): + elif up.scheme in ['http', 'https']: data = requests.get(data, verify=False).content.decode() # if it looks like a telnet URL - elif data.startswith('telnet'): + elif up.scheme == 'telnet': up = urlparse.urlparse(data) telnet_host = up.hostname telnet_port = up.port