mirror of
https://git.sr.ht/~cadence/NewLeaf
synced 2026-05-04 16:41:37 +00:00
Remove with requests when it is unnecessary
This commit is contained in:
parent
73b4fbabf7
commit
68cfbb809f
6 changed files with 244 additions and 244 deletions
16
index.py
16
index.py
|
|
@ -123,17 +123,17 @@ class NewLeaf(object):
|
|||
|
||||
@cherrypy.expose
|
||||
def vi(self, id, file):
|
||||
with requests.get("https://i.ytimg.com/vi/{}/{}".format(id, file), stream=True) as r:
|
||||
r.raise_for_status()
|
||||
cherrypy.response.headers["content-type"] = r.headers["content-type"]
|
||||
return next(r.iter_content(chunk_size=None))
|
||||
r = requests.get("https://i.ytimg.com/vi/{}/{}".format(id, file), stream=True)
|
||||
r.raise_for_status()
|
||||
cherrypy.response.headers["content-type"] = r.headers["content-type"]
|
||||
return next(r.iter_content(chunk_size=None))
|
||||
|
||||
@cherrypy.expose
|
||||
def ggpht(self, *path):
|
||||
with requests.get("https://yt3.ggpht.com/{}".format("/".join(path)), stream=True) as r:
|
||||
r.raise_for_status()
|
||||
cherrypy.response.headers["content-type"] = r.headers["content-type"]
|
||||
return next(r.iter_content(chunk_size=None))
|
||||
r = requests.get("https://yt3.ggpht.com/{}".format("/".join(path)), stream=True)
|
||||
r.raise_for_status()
|
||||
cherrypy.response.headers["content-type"] = r.headers["content-type"]
|
||||
return next(r.iter_content(chunk_size=None))
|
||||
|
||||
bind_port = getattr(configuration, "bind_port", 3000)
|
||||
bind_host = getattr(configuration, "bind_host", "0.0.0.0")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue