diff --git a/sofa_deriver.py b/sofa_deriver.py index 0cc13b2..1126f5a 100644 --- a/sofa_deriver.py +++ b/sofa_deriver.py @@ -382,7 +382,7 @@ def download_sofa(url=None, dlloc='.', verbose=True): from six.moves.urllib.request import urlretrieve if url is None: - url = _find_sofa_url_on_web_page() + url = "https://www.iausofa.org/s/sofa_c-20231011tar.gz" fn = url.split('/')[-1] if not os.path.isdir(dlloc): @@ -396,41 +396,6 @@ def download_sofa(url=None, dlloc='.', verbose=True): return retfn -def _find_sofa_url_on_web_page(url='http://www.iausofa.org/current_C.html'): - """ - Finds and returns the download URL for the latest C SOFA. - """ - from urllib.request import urlopen - from html.parser import HTMLParser - - # Create a subclass to override the handler methods. - class SOFAParser(HTMLParser): - def __init__(self): - self.matched_urls = [] - super().__init__() - - def handle_starttag(self, tag, attrs): - if tag == 'a' and attrs[-1][-1].endswith('.tar.gz'): - self.matched_urls.append(attrs[-1][-1]) - - parser = SOFAParser() - u = urlopen(url) - try: - for ln in u: - parser.feed(ln.decode()) - finally: - u.close() - - baseurl = '/'.join(url.split('/')[:-1]) - fullurls = [(baseurl + m) for m in parser.matched_urls] - - if len(fullurls) != 1: - raise ValueError('Found *multiple* possible downloads: ' + - str(fullurls)) - - return fullurls[0] - - if __name__ == '__main__': import glob import tarfile