qtpyqtqnetworkrequest

how to determine what is the QNetworkRequest Method (get or post)?


When i use QWebView to browse websites and monitor requests using QWevView.Page().networkAccessManager().finished signal, how can I detemine what is taht request method (Post or Get)?

this is my code:

def __init__()
    self.web=QWebView()
    self.web.setUrl(myUrl)
    self.web.page().networkAccessManager().finished.connect(self.checkMethod)
    self.web.show()

def checkMethod(self,reply):
    req=reply.request()
    print(req.Method())# what can I do for this?

Solution

  • you can useroperation() method for this it return QNetworkAccessManager::Operation which include { HeadOperation, GetOperation, PutOperation, PostOperation, DeleteOperation, CustomOperation }