in pelican/plugins/spu.py [0:0]
def spu_cmd_fetch(args: list):
"""Fetches an external URL and put the content where the call was made"""
url = args[0]
url_parsed = urllib.parse.urlparse(url)
is_safe = any(fnmatch.fnmatch(url_parsed.netloc, pattern) for pattern in SPU_FETCH_SAFE_DOMAINS)
if is_safe:
print("Fetching external resource " + url)
return requests.get(url, timeout=REQUESTS_TIMEOUT).text
else:
print("Not fetching unsafe external resource " + url)
return ""