theme-v4 / utils.py
deepkyu
initial commit
10f38d9
raw
history blame
271 Bytes
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()