Shifted try except block placement

This commit is contained in:
kuldeep.k@cisinlabs.com 2021-09-07 22:22:07 +05:30
parent 222cfaa92a
commit 2821f0f667
No known key found for this signature in database
GPG Key ID: AF4FB299BF7C7C2A

View File

@ -245,18 +245,19 @@ class namecoinConnection(object):
"Authorization", "Basic %s" % base64.b64encode(authstr)) "Authorization", "Basic %s" % base64.b64encode(authstr))
self.con.endheaders() self.con.endheaders()
self.con.send(data) self.con.send(data)
try:
resp = self.con.getresponse()
result = resp.read()
if resp.status != 200:
raise Exception(
"Namecoin returned status"
" %i: %s" % (resp.status, resp.reason))
except: # noqa:E722
logger.info("HTTP receive error")
except: # noqa:E722 except: # noqa:E722
logger.info("HTTP connection error") logger.info("HTTP connection error")
try:
resp = self.con.getresponse()
result = resp.read()
if resp.status != 200:
raise Exception(
"Namecoin returned status"
" %i: %s" % (resp.status, resp.reason))
except: # noqa:E722
logger.info("HTTP receive error")
return result return result
def queryServer(self, data): def queryServer(self, data):