From d133cf84ad507637c12bb5e2e1e9b48dca901b27 Mon Sep 17 00:00:00 2001 From: Bryan Hilbert Date: Wed, 18 Dec 2024 09:57:51 -0500 Subject: [PATCH] Switch URL for prog info scraping to use the OPO site --- jwql/website/apps/jwql/data_containers.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/jwql/website/apps/jwql/data_containers.py b/jwql/website/apps/jwql/data_containers.py index 9819282fa..2eb0a00fd 100644 --- a/jwql/website/apps/jwql/data_containers.py +++ b/jwql/website/apps/jwql/data_containers.py @@ -2057,12 +2057,15 @@ def text_scrape(prop_id): program_meta : dict Dictionary containing information about program """ + # Ensure prop_id is a 5-digit string + prop_id = str(prop_id).zfill(5) # Generate url - url = 'http://www.stsci.edu/cgi-bin/get-proposal-info?id=' + str(prop_id) + '&submit=Go&observatory=JWST' + url = f'https://www.stsci.edu/jwst-program-info/program/?program={prop_id}' html = BeautifulSoup(requests.get(url).text, 'lxml') not_available = "not available via this interface" in html.text not_available |= "temporarily unable" in html.text + not_available |= "internal error" in html.text program_meta = {} program_meta['prop_id'] = prop_id