I want to send a http GET
request using QWebEngineHttpRequest.
I know it is possible, as I found this question with a POST
request using it.
So, I've ended up with some code but it doesn't work. Let's say I want to make a get request to facebook webpage and print the answer, which should be the HTML content of the page.
import sys
from PyQt5 import *
def handle_response():
print(bytes(replyObject.readAll()).decode("utf-8"))
if __name__ == "__main__":
def app():
app = QApplication(sys.argv)
req = QtWebEngineCore.QWebEngineHttpRequest(QUrl("https://stackoverflow.com/questions/51686198/",
method=QWebEngineHttpRequest.Get)
req.setHeader(QByteArray(b'Content-Type'),QByteArray(b'application/json'))
web = QWebEngineView()
web.loadFinished.connect(on_load_finished) # will be error
sys.exit(app.exec_())