My Code: (relevent parts)

Qt Code:
  1. def update(self):
  2. request = QNetworkRequest()
  3. request.setUrl(QUrl("someurl"))
  4. self.network_manager.finished.connect(self._update)
  5. self.network_manager.get(request)
  6.  
  7. def _update(self, reply): # update stage 2
  8. if not reply.error() == QNetworkReply.NoError:
  9. # request probably failed
  10. print(reply.error())
  11. print(reply.errorString())
  12. print("retrying")
  13. self.update()
  14. else:
  15. reply.abort()
  16. #print(str(reply.readAll().data()))
  17. data = json.loads(str(reply.readAll().data())) # get data
  18. #work with the data (irrelevant)
  19.  
  20. def sendBearer_req(self):
  21.  
  22. request = QNetworkRequest()
  23. request.setUrl(QUrl("someotherurl"))
  24.  
  25. self.network_manager = QNetworkAccessManager()
  26. self.network_manager.finished.connect(self._request_finished)
  27.  
  28. self.network_manager.post(request, self.urlencode_post({'some' : 'thing'}))
  29.  
  30. def sendBearer(self, reply):
  31. reply.abort()
  32. ans = reply.readAll()
  33. print(ans)
  34. time.sleep(5)
  35. print(ans)
  36.  
  37. try:
  38. self.bearer = json.loads(str(ans))
  39. self.update()
  40. except:
  41. raise #for debugging
  42. self.sendBearer_req() #retry
  43.  
  44. def _request_finished(self, reply):
  45. if not reply.error() == QNetworkReply.NoError:
  46. # request probably failed
  47. print(reply.error())
  48. print(reply.errorString())
  49. print("retrying")
  50. self.sendBearer_req()
  51. else:
  52. self.sendBearer(reply)
To copy to clipboard, switch view to plain text mode 

Problem:

in this part:

Qt Code:
  1. reply.abort()
  2. ans = reply.readAll()
  3. print(ans)
  4. time.sleep(5)
  5. print(ans)
To copy to clipboard, switch view to plain text mode 

I'm pretty sure the `abort` isn't working because on the first `print` it prints just what i want but then, while it waits, apparently it continues with the code and enters the `update` function where it sends another request. Therefor in the second `print` the two replies mix together and it prints the both.

(btw I tried `close` as well - same result)

What am I doing wrong?