File size: 271 Bytes
10f38d9 |
1 2 3 4 5 6 7 8 9 10 |
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() |