Run urlcleanup() before running urlopen()
This commit is contained in:
parent
8407e980cb
commit
96562f6298
1 changed files with 2 additions and 1 deletions
|
@ -1,5 +1,5 @@
|
|||
from http.server import BaseHTTPRequestHandler
|
||||
from urllib.request import urlopen
|
||||
from urllib.request import urlopen, urlcleanup
|
||||
from urllib.error import URLError
|
||||
from socket import error, timeout
|
||||
from io import BytesIO
|
||||
|
@ -17,6 +17,7 @@ class ImageHandler(BaseHTTPRequestHandler):
|
|||
def get_next_image(self):
|
||||
try:
|
||||
bfr = BytesIO()
|
||||
urlcleanup()
|
||||
src = urlopen(self.source_image).read()
|
||||
bfr.write(src)
|
||||
bfr.seek(0)
|
||||
|
|
Loading…
Reference in a new issue