MCPcopy Create free account
hub / github.com/apache/solr / getHREFs

Function getHREFs

dev-tools/scripts/smokeTestRelease.py:73–104  ·  view source on GitHub ↗
(urlString)

Source from the content-addressed store, hash-verified

71 parsed = urllib.parse.urlparse(url)
72 if parsed[0] in ('http', 'https'):
73 h = http.client.HTTPConnection(parsed.netloc)
74 h.request('HEAD', parsed.path)
75 response = h.getresponse()
76 if int(response.status/100) == 3 and response.getheader('Location'):
77 return response.getheader('Location')
78 return url
79
80# TODO
81# - make sure jars exist inside bin release
82# - make sure docs exist
83
84reHREF = re.compile('<a href="(.*?)">(.*?)</a>')
85
86# Set to False to avoid re-downloading the packages...
87FORCE_CLEAN = True
88
89
90def getHREFs(urlString):
91
92 # Deref any redirects
93 while True:
94 url = urllib.parse.urlparse(urlString)
95 if url.scheme == "http":
96 h = http.client.HTTPConnection(url.netloc)
97 elif url.scheme == "https":
98 h = http.client.HTTPSConnection(url.netloc)
99 else:
100 raise RuntimeError("Unknown protocol: %s" % url.scheme)
101 h.request('HEAD', url.path)
102 r = h.getresponse()
103 newLoc = r.getheader('location')
104 if newLoc is not None:
105 urlString = newLoc
106 else:
107 break

Callers 1

getDirEntriesFunction · 0.85

Calls 3

loadFunction · 0.70
appendMethod · 0.65
requestMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…