szurubooru/server/szurubooru/func/net.py
rr- 9aea55e3d1 server/general: embrace most of PEP8
Ignored only the rules about continuing / hanging indentation.

Also, added __init__.py to tests so that pylint discovers them. (I don't
buy pytest's BS about installing your package.)
2016-08-14 16:44:03 +02:00

9 lines
220 B
Python

import urllib.request
def download(url):
assert url
request = urllib.request.Request(url)
request.add_header('Referer', url)
with urllib.request.urlopen(request) as handle:
return handle.read()