Lines Matching refs:location
37 _is_url = lambda location: '://' in location # RFC 3986
40 @@ -72,6 +76,29 @@ def load_to_file(location, destination):
41 _copy_file(location, destination)
44 +def _access_url(location):
52 + request = requests.get(location, verify=SSL_VERIFY, timeout=2)
54 + log.info("Try '%s' %d times, %s" % (location, i, str(e)))
67 def _get_auth(location, user=None, passwd=None):
70 @@ -93,6 +120,10 @@ def _get_auth(location, user=None, passwd=None):
72 def _load_url(location, user=None, passwd=None):
73 '''Load a location (URL or filename) and return contents as string'''
75 + if not _access_url(location):
76 + raise KickstartError(_("Connection %s failed" % location))
78 auth = _get_auth(location, user=user, passwd=passwd)
80 request = requests.get(location, verify=SSL_VERIFY, auth=auth)