本文整理汇总了Python中PySide.QtCore.QUrl.setPath方法的典型用法代码示例。如果您正苦于以下问题:Python QUrl.setPath方法的具体用法?Python QUrl.setPath怎么用?Python QUrl.setPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PySide.QtCore.QUrl
的用法示例。
在下文中一共展示了QUrl.setPath方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_connection
# 需要导入模块: from PySide.QtCore import QUrl [as 别名]
# 或者: from PySide.QtCore.QUrl import setPath [as 别名]
def test_connection(self):
self.message.setText('<span style="font-size: 10px; color: #000000;">' +
'Verbindung wird getestet.' +
'</span>')
self.nam.finished.connect(self.test_reply)
self.nam.sslErrors.connect(self.ssl_errors)
ssl_config = QSslConfiguration().defaultConfiguration()
ssl_config.setCiphers(QSslSocket().supportedCiphers())
if self.certificate:
certificate = QSslCertificate(encoded=self.certificate, format=QSsl.Pem)
ssl_config.setCaCertificates([certificate])
else:
ssl_config.setCaCertificates([])
url = QUrl(self.url_edit.text())
url.setPath("/".join(filter(bool, (url.path() + "/ajax/read.php").split("/"))))
request = QNetworkRequest(url)
request.setSslConfiguration(ssl_config)
request.setRawHeader("Authorization",
"Basic ".encode('utf-8') +
b64encode((self.username_edit.text() + ":" + self.password_edit.text()).encode('utf-8')))
request.setHeader(QNetworkRequest.ContentTypeHeader, "application/x-www-form-urlencoded")
self.replies.add(self.nam.post(request, QByteArray()))
示例2: testSetAttributes
# 需要导入模块: from PySide.QtCore import QUrl [as 别名]
# 或者: from PySide.QtCore.QUrl import setPath [as 别名]
def testSetAttributes(self):
#Construct QUrl by set* methods
url = QUrl()
url.setScheme('ftp')
self.assertEqual(url.toString(), 'ftp:')
url.setHost('www.google.com')
self.assertEqual(url.toString(), 'ftp://www.google.com')
url.setPort(8080)
self.assertEqual(url.toString(), 'ftp://www.google.com:8080')
url.setPath('mail/view')
self.assertEqual(url.toString(),
'ftp://www.google.com:8080/mail/view')
url.setUserName('john')
self.assertEqual(url.toString(),
'ftp://[email protected]:8080/mail/view')
url.setPassword('abc123')
self.assertEqual(url.toString(),
'ftp://john:[email protected]:8080/mail/view')