本文整理汇总了Python中PyQt5.QtCore.QUrlQuery.query方法的典型用法代码示例。如果您正苦于以下问题:Python QUrlQuery.query方法的具体用法?Python QUrlQuery.query怎么用?Python QUrlQuery.query使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.QtCore.QUrlQuery
的用法示例。
在下文中一共展示了QUrlQuery.query方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: refresh_access_token
# 需要导入模块: from PyQt5.QtCore import QUrlQuery [as 别名]
# 或者: from PyQt5.QtCore.QUrlQuery import query [as 别名]
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)
示例2: exchange_authorization_code
# 需要导入模块: from PyQt5.QtCore import QUrlQuery [as 别名]
# 或者: from PyQt5.QtCore.QUrlQuery import query [as 别名]
def exchange_authorization_code(self, authorization_code, scopes, callback):
log.debug("OAuth: exchanging authorization_code %s for an access_token", authorization_code)
host, port = config.setting['server_host'], config.setting['server_port']
path = "/oauth2/token"
url = QUrl()
url_query = QUrlQuery()
url_query.addQueryItem("grant_type", "authorization_code")
url_query.addQueryItem("code", authorization_code)
url_query.addQueryItem("client_id", MUSICBRAINZ_OAUTH_CLIENT_ID)
url_query.addQueryItem("client_secret", MUSICBRAINZ_OAUTH_CLIENT_SECRET)
url_query.addQueryItem("redirect_uri", "urn:ietf:wg:oauth:2.0:oob")
url.setQuery(url_query.query(QUrl.FullyEncoded))
data = string_(url.query())
self.webservice.post(host, port, path, data,
partial(self.on_exchange_authorization_code_finished, scopes, callback),
parse_response_type=None, mblogin=True, priority=True, important=True)