code: def connectionLost(self, reason):
          
          self.remaining.reset()
  
          try:
              result = json.load(self.remaining)
          except Exception, e:
              self.finished.errback(e)
              return
  
          returnValue = result
          if self.heartbeater:
              self.heartbeater.nextToken = result['token']
              returnValue = (result, self.heartbeater)
  
          self.finished.callback(returnValue)
docs: Called when the response body has been completely delivered.
          @param reason: Either a twisted.web.client.ResponseDone exception or
          a twisted.web.http.PotentialDataLoss exception.