Skip to content
20 changes: 20 additions & 0 deletions astroquery/wfau/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -479,6 +479,26 @@ def parse_imagequery_page(self, html_in, radius=None):
for row in html_in.split("\n")])
return ascii.read(html, format='html')

def extract_urls(self, html_in):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I commented this before in another module: I think methods like this should not be class methods, definitely not public ones, but instead private functions.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, I agree - happy to make this, and get_image_list, both private

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can't make get_image_list private, at least not without a deprecation period.

"""
Helper function that uses regexps to extract the image urls from the
given HTML.

Parameters
----------
html_in : str
source from which the urls are to be extracted.

Returns
-------
links : list
The list of URLS extracted from the input.
"""
# Parse html input for links
ahref = re.compile(r'href="([a-zA-Z0-9_\.&\?=%/:-]+)"')
links = ahref.findall(html_in)
return links

def query_region(self, coordinates, *, radius=1 * u.arcmin,
programme_id=None, database=None,
verbose=False, get_query_payload=False, system='J2000',
Expand Down