Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2835ad6

Browse files
committed
Minor exception adjustment
1 parent 0e1bbf6 commit 2835ad6

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

extra/keepalive/keepalive.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,7 @@ def _start_connection(self, h, req):
120120
data = req.get_data()
121121
h.putrequest('POST', req.get_selector())
122122
if not req.headers.has_key('Content-type'):
123-
h.putheader('Content-type',
124-
'application/x-www-form-urlencoded')
123+
h.putheader('Content-type', 'application/x-www-form-urlencoded')
125124
if not req.headers.has_key('Content-length'):
126125
h.putheader('Content-length', '%d' % len(data))
127126
else:
@@ -134,9 +133,9 @@ def _start_connection(self, h, req):
134133
h.endheaders()
135134
if req.has_data():
136135
h.send(data)
137-
except:
136+
except socket.error, err:
138137
h.close()
139-
raise
138+
raise urllib2.URLError(err)
140139

141140
def do_open(self, http_class, req):
142141
host = req.get_host()

0 commit comments

Comments
 (0)