(urlString)
| 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 | |
| 84 | reHREF = re.compile('<a href="(.*?)">(.*?)</a>') |
| 85 | |
| 86 | # Set to False to avoid re-downloading the packages... |
| 87 | FORCE_CLEAN = True |
| 88 | |
| 89 | |
| 90 | def 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 |
no test coverage detected
searching dependent graphs…