hgext/bugzilla.py
branchstable
changeset 43380 579672b347d2
parent 43115 4aa72cdf616f
child 43506 9f70512ae2cf
equal deleted inserted replaced
43379:bb509f39d387 43380:579672b347d2
   953         return url
   953         return url
   954 
   954 
   955     def _fetch(self, burl):
   955     def _fetch(self, burl):
   956         try:
   956         try:
   957             resp = url.open(self.ui, burl)
   957             resp = url.open(self.ui, burl)
   958             return json.loads(resp.read())
   958             return pycompat.json_loads(resp.read())
   959         except util.urlerr.httperror as inst:
   959         except util.urlerr.httperror as inst:
   960             if inst.code == 401:
   960             if inst.code == 401:
   961                 raise error.Abort(_(b'authorization failed'))
   961                 raise error.Abort(_(b'authorization failed'))
   962             if inst.code == 404:
   962             if inst.code == 404:
   963                 raise NotFound()
   963                 raise NotFound()
   976         else:
   976         else:
   977             request_type = util.urlreq.request
   977             request_type = util.urlreq.request
   978         req = request_type(burl, data, {b'Content-Type': b'application/json'})
   978         req = request_type(burl, data, {b'Content-Type': b'application/json'})
   979         try:
   979         try:
   980             resp = url.opener(self.ui).open(req)
   980             resp = url.opener(self.ui).open(req)
   981             return json.loads(resp.read())
   981             return pycompat.json_loads(resp.read())
   982         except util.urlerr.httperror as inst:
   982         except util.urlerr.httperror as inst:
   983             if inst.code == 401:
   983             if inst.code == 401:
   984                 raise error.Abort(_(b'authorization failed'))
   984                 raise error.Abort(_(b'authorization failed'))
   985             if inst.code == 404:
   985             if inst.code == 404:
   986                 raise NotFound()
   986                 raise NotFound()