当前位置: 首页>>代码示例>>Python>>正文


Python QUrl.queryItems方法代码示例

本文整理汇总了Python中PySide.QtCore.QUrl.queryItems方法的典型用法代码示例。如果您正苦于以下问题:Python QUrl.queryItems方法的具体用法?Python QUrl.queryItems怎么用?Python QUrl.queryItems使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PySide.QtCore.QUrl的用法示例。


在下文中一共展示了QUrl.queryItems方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: testAddQueryItem

# 需要导入模块: from PySide.QtCore import QUrl [as 别名]
# 或者: from PySide.QtCore.QUrl import queryItems [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))
开发者ID:Hasimir,项目名称:PySide,代码行数:12,代码来源:qurl_test.py

示例2: testSetQueryItems

# 需要导入模块: from PySide.QtCore import QUrl [as 别名]
# 或者: from PySide.QtCore.QUrl import queryItems [as 别名]
    def testSetQueryItems(self):
        #QUrl.setQueryItems
        urla = QUrl('http://www.google.com/search?q=python&hl=en')
        urlb = QUrl('http://www.google.com/search')

        urlb.setQueryItems(urla.queryItems())

        self.assertEqual(urla, urlb)
开发者ID:Hasimir,项目名称:PySide,代码行数:10,代码来源:qurl_test.py

示例3: _slot_httpResponseFinished

# 需要导入模块: from PySide.QtCore import QUrl [as 别名]
# 或者: from PySide.QtCore.QUrl import queryItems [as 别名]
    def _slot_httpResponseFinished(self, reply):
        """
        Slot for QWebView's QNetworkAccessManager finished signal.

        @param reply (QNetworkReply)
        """

        #print "REPLY::ERROR>> ", reply.error()
        #print "REPLY::FINISHED>> ", self.url()

        url = self.url()

#    # -------------------------------------------------------------------------
#
#    def _slot_urlChanged(self, url):
#        """
#        Slot for QWebView urlChanged signal.
#
#        @param url (QUrl)
#        """

        # ---------------------------------------------------------------------
        # PARSE URL DATA
        # ---------------------------------------------------------------------

        fragment = url.fragment()
        path = url.path()
        query_items = dict(url.queryItems())

        fragment_items = []
        if fragment:
            qu = QUrl()
            qu.setEncodedQuery(str(fragment))

            fragment_items = qu.queryItems()

            # push fragment values into query items dict
            for i in fragment_items:
                query_items[i[0]] = i[1]

        state = ""
        if "state" in query_items:
            state = query_items["state"]

        # ---------------------------------------------------------------------
        # FIRE DESTINATION SIGNALS
        # ---------------------------------------------------------------------

        if "error" in query_items:
            error_reason = ""
            if "error_reason" in query_items:
                reason = query_items["error_reason"]

            error_description = ""
            if "error_description" in query_items:
                description = query_items["error_description"].replace("+"," ")

            # user canceled before granting permissions
            self.signal_permsNotAuthorized.emit(query_items["error"], reason,
                    description, state)

            return

        if path == "/login.php":
            if "skip_api_login" in query_items:
                # initial load of the login form
                self.signal_authFormReady.emit(state)

                return

            elif "login_attempt" in query_items:
                # user login credentials invalid
                self.signal_authFail.emit(state)

                return

        elif path == "/dialog/permissions.request":
            if "from_login" in query_items:
                # user authenticated successfully
                self.signal_authSuccess.emit(state)

                return

        elif path == "/connect/login_success.html":
            if "access_token" in query_items:
                access_token = query_items["access_token"]

                expires_in = 0
                if "expires_in" in query_items:
                    expires_in = int(query_items["expires_in"])

                # permissions authorized and access token received
                self.signal_permsAuthorizedAccessToken.emit(access_token,
                        expires_in, state)

                return

            elif "code" in query_items:
                oauth_code = query_items["code"]

#.........这里部分代码省略.........
开发者ID:AbleCoder,项目名称:pyside-facebook,代码行数:103,代码来源:pyside_facebook.py

示例4: testQueryItems

# 需要导入模块: from PySide.QtCore import QUrl [as 别名]
# 或者: from PySide.QtCore.QUrl import queryItems [as 别名]
    def testQueryItems(self):
        #QUrl.queryItems
        url = QUrl('http://www.google.com/search?q=python&hl=en')
        valid_data = [(('q'), ('python')), (('hl'), ('en'))]

        self.assertEqual(sorted(url.queryItems()), sorted(valid_data))
开发者ID:Hasimir,项目名称:PySide,代码行数:8,代码来源:qurl_test.py


注:本文中的PySide.QtCore.QUrl.queryItems方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。