本文整理汇总了Python中PySide.QtCore.QUrl.addQueryItem方法的典型用法代码示例。如果您正苦于以下问题:Python QUrl.addQueryItem方法的具体用法?Python QUrl.addQueryItem怎么用?Python QUrl.addQueryItem使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PySide.QtCore.QUrl
的用法示例。
在下文中一共展示了QUrl.addQueryItem方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _urlencode_request_data
# 需要导入模块: from PySide.QtCore import QUrl [as 别名]
# 或者: from PySide.QtCore.QUrl import addQueryItem [as 别名]
def _urlencode_request_data(self, raw_data):
# the data which we want to send to the server must be urlencoded
request_data = QUrl()
for (name, value) in raw_data.items():
request_data.addQueryItem(name, unicode(value))
return request_data.encodedQuery()
示例2: email_note
# 需要导入模块: from PySide.QtCore import QUrl [as 别名]
# 或者: from PySide.QtCore.QUrl import addQueryItem [as 别名]
def email_note(self):
body = self.page.mainFrame().toPlainText()[
len(self.title):
].strip()
url = QUrl("mailto:")
url.addQueryItem("subject", self.title)
url.addQueryItem("body", body)
QDesktopServices.openUrl(url)
示例3: testAllEncodedQueryItemsValues
# 需要导入模块: from PySide.QtCore import QUrl [as 别名]
# 或者: from PySide.QtCore.QUrl import addQueryItem [as 别名]
def testAllEncodedQueryItemsValues(self):
#QUrl.allEncodedQueryItemValues
url = QUrl()
key = 'key'
valid_data = ['data', 'valid', 'test']
for i, data in enumerate(valid_data):
url.addQueryItem(key, data)
self.assertEqual(url.allEncodedQueryItemValues(key),
list(valid_data[:i+1]))
示例4: testAddQueryItem
# 需要导入模块: from PySide.QtCore import QUrl [as 别名]
# 或者: from PySide.QtCore.QUrl import addQueryItem [as 别名]
def testAddQueryItem(self):
#QUrl.addQueryItem
url = QUrl()
valid_data = [('hl', 'en'), ('user', 'konqui')]
url.addQueryItem(*valid_data[0])
self.assertEqual(url.queryItems()[0], valid_data[0])
url.addQueryItem(*valid_data[1])
self.assertEqual(sorted(url.queryItems()), sorted(valid_data))
示例5: get_oauth_url
# 需要导入模块: from PySide.QtCore import QUrl [as 别名]
# 或者: from PySide.QtCore.QUrl import addQueryItem [as 别名]
def get_oauth_url(self, app_id, redirect_uri, scope, state, response_type,
display):
"""
Return encoded OAuth URL with request params formated as GET params.
@param app_id (str/uni)
@param redirect_uri (str/uni)
@param scope (list)
@param state (str/uni)
@param response_type (str/uni)
@param display (str/uni)
@return (QUrl)
"""
if type(app_id) not in (str, unicode):
raise FBAuthDialogInvalidParamException(
"app_id must be `str` or `unicode` but was: %s" % type(app_id))
if type(redirect_uri) not in (type(None), str, unicode):
raise FBAuthDialogInvalidParamException(
"redirect_uri must be `None`, `str` or `unicode` but was: %s" %
type(redirect_uri))
if type(scope) not in (type(None), list):
raise FBAuthDialogInvalidParamException(
"scope must be `None` or `list` but was: %s" %
type(scope))
if type(state) not in (type(None), str, unicode):
raise FBAuthDialogInvalidParamException(
"state must be `None`, `str` or `unicode` but was: %s" %
type(state))
if type(response_type) not in (type(None), str, unicode):
raise FBAuthDialogInvalidParamException(
"response_type must be `None`, `str` or `unicode` but was: %s"
% type(response_type))
if type(display) not in (type(None), str, unicode):
raise FBAuthDialogInvalidParamException(
"display must be `None`, `str` or `unicode` but was: %s"
% type(display))
url = QUrl(OAUTH_URL)
url.addQueryItem("client_id", app_id)
url.addQueryItem("redirect_uri", redirect_uri)
url.addQueryItem("response_type", response_type)
url.addQueryItem("display", display)
if scope:
_scope = ",".join(map(unicode, scope))
url.addQueryItem("scope", _scope)
if state:
url.addQueryItem("state", state)
return url