Home > Mobile >  PYQT5 QWebEngineView how to realize automatic login loading cookies
PYQT5 QWebEngineView how to realize automatic login loading cookies

Time:10-12

Crash ing... Checked all kinds of information, is still not solve the problem, hope have a great god help answer questions

Need to use PYQT5 can realize the function of automatic login (external web user name and password input, a key to realize automatic login)
My approach is to use interface directly to log in, after the success of the login, obtain the cookie after login, then attach a cookie in QWebEngineView, however a cookie has not to jump to page, always prompt not login


CodePudding user response:

Post so nobody reply for so long?
Your application to do the first page (). The load (), and then setCookie (), on the load is not, of course,
The set first, then the load should be ok:
For the key and the value in cookie_dict. The items () :
Cookie=QNetworkCookie (QByteArray (key) encode ()), QByteArray (value) encode ()))
Browse page (). The profile () cookieStore () setCookie (cookies, QUrl (" http://127.0.0.1/page "))
The browse page (). The load (QUrl (" http://127.0.0.1/page "))

CodePudding user response:

Well, so on the setup process is correct, but there are all kinds of problems may lead to,
  •  Tags:  
  • Qt
  • Related