from pathlib import Path from urllib import request def get_snippet_from_url(url: str) -> str: response = request.urlopen(url) data = response.read().decode() return data def get_snippet_from_file(filepath: str) -> str: return Path(filepath).read_text()