theme-v4 / utils.py
deepkyu's picture
initial commit
10f38d9
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()