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


Python QtCore.QUrlQuery类代码示例

本文整理汇总了Python中PyQt5.QtCore.QUrlQuery的典型用法代码示例。如果您正苦于以下问题:Python QUrlQuery类的具体用法?Python QUrlQuery怎么用?Python QUrlQuery使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: suggestionsUrl

 def suggestionsUrl(self, searchTerm):
     """
     Public method to get a URL ready for suggestions.
     
     @param searchTerm term to search for (string)
     @return URL (QUrl)
     """
     if not self._suggestionsUrlTemplate:
         return QUrl()
     
     ret = QUrl.fromEncoded(QByteArray(self.parseTemplate(
         searchTerm, self._suggestionsUrlTemplate).encode("utf-8")))
     
     if self.__searchMethod != "post":
         if qVersion() >= "5.0.0":
             from PyQt5.QtCore import QUrlQuery
             urlQuery = QUrlQuery(ret)
             for parameter in self._suggestionsParameters:
                 urlQuery.addQueryItem(
                     parameter[0],
                     self.parseTemplate(searchTerm, parameter[1]))
             ret.setQuery(urlQuery)
         else:
             for parameter in self._suggestionsParameters:
                 ret.addQueryItem(
                     parameter[0],
                     self.parseTemplate(searchTerm, parameter[1]))
     
     return ret
开发者ID:testmana2,项目名称:test,代码行数:29,代码来源:OpenSearchEngine.py

示例2: getIpAddressReport

 def getIpAddressReport(self, ipAddress):
     """
     Public method to retrieve a report for an IP address.
     
     @param ipAddress valid IPv4 address in dotted quad notation
     @type str
     """
     self.__lastIP = ipAddress
     
     queryItems = [
         ("apikey", Preferences.getHelp("VirusTotalServiceKey")),
         ("ip", ipAddress),
     ]
     url = QUrl(self.GetIpAddressReportUrl)
     if qVersion() >= "5.0.0":
         from PyQt5.QtCore import QUrlQuery
         query = QUrlQuery()
         query.setQueryItems(queryItems)
         url.setQuery(query)
     else:
         url.setQueryItems(queryItems)
     request = QNetworkRequest(url)
     
     import Helpviewer.HelpWindow
     nam = Helpviewer.HelpWindow.HelpWindow.networkAccessManager()
     reply = nam.get(request)
     reply.finished.connect(self.__getIpAddressReportFinished)
     self.__replies.append(reply)
开发者ID:testmana2,项目名称:test,代码行数:28,代码来源:VirusTotalApi.py

示例3: test_file_pathsep

 def test_file_pathsep(self, sep):
     url = QUrl('qute://pdfjs/file')
     query = QUrlQuery()
     query.addQueryItem('filename', 'foo{}bar'.format(sep))
     url.setQuery(query)
     with pytest.raises(qutescheme.RequestDeniedError):
         qutescheme.data_for_url(url)
开发者ID:mehak,项目名称:qutebrowser,代码行数:7,代码来源:test_qutescheme.py

示例4: url

 def url(self):
     """
     Public method to generate the URL for this subscription.
     
     @return AdBlock URL for the subscription (QUrl)
     """
     url = QUrl()
     url.setScheme("abp")
     url.setPath("subscribe")
     
     queryItems = []
     queryItems.append(("location", bytes(self.__location).decode()))
     queryItems.append(("title", self.__title))
     if self.__requiresLocation and self.__requiresTitle:
         queryItems.append(("requiresLocation", self.__requiresLocation))
         queryItems.append(("requiresTitle", self.__requiresTitle))
     if not self.__enabled:
         queryItems.append(("enabled", "false"))
     if self.__lastUpdate.isValid():
         queryItems.append(("lastUpdate",
                            self.__lastUpdate.toString(Qt.ISODate)))
     if qVersion() >= "5.0.0":
         from PyQt5.QtCore import QUrlQuery
         query = QUrlQuery()
         query.setQueryItems(queryItems)
         url.setQuery(query)
     else:
         url.setQueryItems(queryItems)
     return url
开发者ID:pycom,项目名称:EricShort,代码行数:29,代码来源:AdBlockSubscription.py

示例5: getDomainReport

 def getDomainReport(self, domain):
     """
     Public method to retrieve a report for a domain.
     
     @param domain domain name
     @type str
     """
     self.__lastDomain = domain
     
     queryItems = [
         ("apikey", Preferences.getHelp("VirusTotalServiceKey")),
         ("domain", domain),
     ]
     url = QUrl(self.GetDomainReportUrl)
     if qVersion() >= "5.0.0":
         from PyQt5.QtCore import QUrlQuery
         query = QUrlQuery()
         query.setQueryItems(queryItems)
         url.setQuery(query)
     else:
         url.setQueryItems(queryItems)
     request = QNetworkRequest(url)
     
     import Helpviewer.HelpWindow
     nam = Helpviewer.HelpWindow.HelpWindow.networkAccessManager()
     reply = nam.get(request)
     reply.finished.connect(self.__getDomainReportFinished)
     self.__replies.append(reply)
开发者ID:testmana2,项目名称:test,代码行数:28,代码来源:VirusTotalApi.py

示例6: getHttp

    def getHttp(self, uri, params):
        QgsApplication.setOverrideCursor(Qt.WaitCursor)
        try:
            rq = QUrl(uri)
            q = QUrlQuery()
            for (k, v) in params.items():
                q.addQueryItem(k, v)

            rq.setQuery(q)
            req = QNetworkRequest(rq)

            try:
                reply = self.nominatim_networkAccessManager.blockingGet(req)
                resource = reply.content().data().decode('utf8')
                r = json.loads(resource)

                if (isinstance(r, list)):
                    self.populateTable(r)
                else:
                    self.populateTable([r])
            except:
                self.tableResult.clearContents()

        finally:
            QgsApplication.restoreOverrideCursor()
开发者ID:xcaeag,项目名称:Nominatim-Qgis-Plugin,代码行数:25,代码来源:nominatim_dlg.py

示例7: handle_form_submitted

    def handle_form_submitted(self, qurl, elements=dict()):

        #       print("\n\ngot url: ", qurl)
        qqurl = QUrlQuery(qurl)
        for key, value in qqurl.queryItems():
            elements[key] = value

        self.render(qurl.path(), elements)
开发者ID:superizer,项目名称:hawkeye,代码行数:8,代码来源:window.py

示例8: get_main_url

def get_main_url(filename):
    """Get the URL to be opened to view a local PDF."""
    url = QUrl('qute://pdfjs/web/viewer.html')
    query = QUrlQuery()
    query.addQueryItem('filename', filename)  # read from our JS
    query.addQueryItem('file', '')  # to avoid pdfjs opening the default PDF
    url.setQuery(query)
    return url
开发者ID:The-Compiler,项目名称:qutebrowser,代码行数:8,代码来源:pdfjs.py

示例9: acceptNavigationRequest

 def acceptNavigationRequest(self, url, _type, isMainFrame):
     query = QUrlQuery(url)
     if query.hasQueryItem("requrl"):
         orig_url = query.queryItemValue("requrl", QUrl.FullyDecoded)
         url = QUrl(orig_url)
         QDesktopServices.openUrl(url)
         return False
     return super().acceptNavigationRequest(url, _type, isMainFrame)
开发者ID:zhsj,项目名称:qwechat,代码行数:8,代码来源:view.py

示例10: link_clicked

    def link_clicked(self, qurl):
        # print("link_clicked ->: ", qurl)
        qqurl = QUrlQuery(qurl)
        elements = {}
        # print("got link_clicked url: ", qurl)
        for key, value in qqurl.queryItems():
            elements[key] = value

        self.render(qurl.path(), elements)
开发者ID:superizer,项目名称:hawkeye,代码行数:9,代码来源:window.py

示例11: email

def email(subject, body):
    """Opens the e-mail composer with the given subject and body, with version information added to it."""
    subject = "[{0} {1}] {2}".format(appinfo.appname, appinfo.version, subject)
    body = "{0}\n\n{1}\n\n".format(debuginfo.version_info_string(' -- '), body)
    url = QUrl("mailto:" + appinfo.maintainer_email)
    query = QUrlQuery()
    query.addQueryItem("subject", subject)
    query.addQueryItem("body", body)
    url.setQuery(query)
    helpers.openUrl(url, "email")
开发者ID:19joho66,项目名称:frescobaldi,代码行数:10,代码来源:bugreport.py

示例12: wrapper

    def wrapper(SELF, request):
        # Looking for Pid in query string, try matching with locally bound peerid
        localPeerId = app.xwaredpy.peerId
        if not localPeerId:
            return request

        urlQuery = QUrlQuery(request.url())
        queryItems = dict(urlQuery.queryItems())
        if queryItems.get("pid", None) != localPeerId:
            return request
        return func(SELF, request)
开发者ID:bugmoto,项目名称:XwareDesktop,代码行数:11,代码来源:CNetworkAccessManager.py

示例13: refresh_access_token

 def refresh_access_token(self, callback):
     refresh_token = config.persist["oauth_refresh_token"]
     log.debug("OAuth: refreshing access_token with a refresh_token %s", refresh_token)
     host, port = config.setting['server_host'], config.setting['server_port']
     path = "/oauth2/token"
     url = QUrl()
     url_query = QUrlQuery()
     url_query.addQueryItem("grant_type", "refresh_token")
     url_query.addQueryItem("refresh_token", refresh_token)
     url_query.addQueryItem("client_id", MUSICBRAINZ_OAUTH_CLIENT_ID)
     url_query.addQueryItem("client_secret", MUSICBRAINZ_OAUTH_CLIENT_SECRET)
     url.setQuery(url_query.query(QUrl.FullyEncoded))
     data = string_(url.query())
     self.webservice.post(host, port, path, data,
                     partial(self.on_refresh_access_token_finished, callback),
                     parse_response_type=None, mblogin=True, priority=True, important=True)
开发者ID:Sophist-UK,项目名称:Sophist_picard,代码行数:16,代码来源:oauth.py

示例14: load_account_page

 def load_account_page(self, account, tab=None, task=None, reset_history=False, set_home=False):
     self.tab = tab
     self.task = task
     self.account = account
     url = QUrl(account.server.settings_url)
     url_query = QUrlQuery()
     for name, value in self.query_items:
         url_query.addQueryItem(name, value)
     url.setQuery(url_query)
     if set_home:
         self.homepage = url
     if reset_history:
         self.history().clear()
         self.page().mainFrame().evaluateJavaScript('window.location.replace("{}");'.format(url.toString()))  # this will replace the current url in the history
     else:
         self.load(url)
开发者ID:AGProjects,项目名称:blink-qt,代码行数:16,代码来源:accounts.py

示例15: _preprocess_request_bind

    def _preprocess_request_bind(request):
        # set boxName when binding the device to hostname

        urlQuery = QUrlQuery(request.url())
        queryItems = urlQuery.queryItems()

        for i, item in enumerate(queryItems):
            if item[0] == "boxName":
                queryItems[i] = ("boxName", os.uname().nodename)
        urlQuery.setQueryItems(queryItems)

        # write changes back to request
        qurl = request.url()
        qurl.setQuery(urlQuery)
        request.setUrl(qurl)

        return request
开发者ID:bugmoto,项目名称:XwareDesktop,代码行数:17,代码来源:CNetworkAccessManager.py


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