9 |
9 |
10 from __future__ import unicode_literals |
10 from __future__ import unicode_literals |
11 |
11 |
12 import os |
12 import os |
13 |
13 |
14 from PyQt5.QtCore import pyqtSignal, QObject, QByteArray, QUrl, QUrlQuery, \ |
14 from PyQt5.QtCore import pyqtSignal, QObject, QByteArray, QUrl, \ |
15 QCoreApplication, QXmlStreamReader |
15 QCoreApplication, QXmlStreamReader, qVersion |
16 from PyQt5.QtWidgets import QApplication |
16 from PyQt5.QtWidgets import QApplication |
17 from PyQt5.QtNetwork import QNetworkRequest |
17 from PyQt5.QtNetwork import QNetworkRequest |
18 from PyQt5.QtWebKit import QWebSettings |
18 from PyQt5.QtWebKit import QWebSettings |
19 from PyQt5.QtWebKitWidgets import QWebPage |
19 from PyQt5.QtWebKitWidgets import QWebPage |
20 |
20 |
435 |
435 |
436 @param url URL to be stripped (QUrl) |
436 @param url URL to be stripped (QUrl) |
437 @return stripped URL (QUrl) |
437 @return stripped URL (QUrl) |
438 """ |
438 """ |
439 cleanUrl = QUrl(url) |
439 cleanUrl = QUrl(url) |
440 cleanUrl.setQuery("") |
440 if qVersion() >= "5.0.0": |
|
441 cleanUrl.setQuery("") |
|
442 else: |
|
443 cleanUrl.setQueryItems([]) |
441 cleanUrl.setUserInfo("") |
444 cleanUrl.setUserInfo("") |
442 |
445 |
443 authority = cleanUrl.authority() |
446 authority = cleanUrl.authority() |
444 if authority.startswith("@"): |
447 if authority.startswith("@"): |
445 authority = authority[1:] |
448 authority = authority[1:] |
461 from .LoginForm import LoginForm |
464 from .LoginForm import LoginForm |
462 form = LoginForm() |
465 form = LoginForm() |
463 if boundary is not None: |
466 if boundary is not None: |
464 args = self.__extractMultipartQueryItems(data, boundary) |
467 args = self.__extractMultipartQueryItems(data, boundary) |
465 else: |
468 else: |
466 argsUrl = QUrl.fromEncoded( |
469 if qVersion() >= "5.0.0": |
467 QByteArray("foo://bar.com/?" + QUrl.fromPercentEncoding( |
470 from PyQt5.QtCore import QUrlQuery |
468 data.replace(b"+", b"%20")))) |
471 argsUrl = QUrl.fromEncoded( |
469 encodedArgs = QUrlQuery(argsUrl).queryItems() |
472 QByteArray("foo://bar.com/?" + QUrl.fromPercentEncoding( |
|
473 data.replace(b"+", b"%20")))) |
|
474 encodedArgs = QUrlQuery(argsUrl).queryItems() |
|
475 else: |
|
476 argsUrl = QUrl.fromEncoded( |
|
477 QByteArray("foo://bar.com/?" + data.replace(b"+", b"%20"))) |
|
478 encodedArgs = argsUrl.queryItems() |
470 args = set() |
479 args = set() |
471 for arg in encodedArgs: |
480 for arg in encodedArgs: |
472 key = arg[0] |
481 key = arg[0] |
473 value = arg[1] |
482 value = arg[1] |
474 args.add((key, value)) |
483 args.add((key, value)) |