Handle RemoteDisconnected error

This commit is contained in:
Marcin Kulik
2017-12-01 22:28:30 +01:00
parent 134ca2c9d8
commit 4286e8f480

View File

@@ -3,6 +3,7 @@ import sys
import uuid import uuid
import io import io
import base64 import base64
import http
from urllib.request import Request, urlopen from urllib.request import Request, urlopen
from urllib.error import HTTPError, URLError from urllib.error import HTTPError, URLError
@@ -80,7 +81,7 @@ class URLLibHttpAdapter:
status = e.code status = e.code
headers = {} headers = {}
body = e.read().decode('utf-8') body = e.read().decode('utf-8')
except URLError as e: except (http.client.RemoteDisconnected, URLError) as e:
raise HTTPConnectionError(str(e)) raise HTTPConnectionError(str(e))
return (status, headers, body) return (status, headers, body)