當前位置: 首頁>>代碼示例>>Python>>正文


Python _helpers.parse_unique_urlencoded方法代碼示例

本文整理匯總了Python中oauth2client._helpers.parse_unique_urlencoded方法的典型用法代碼示例。如果您正苦於以下問題:Python _helpers.parse_unique_urlencoded方法的具體用法?Python _helpers.parse_unique_urlencoded怎麽用?Python _helpers.parse_unique_urlencoded使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在oauth2client._helpers的用法示例。


在下文中一共展示了_helpers.parse_unique_urlencoded方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: do_GET

# 需要導入模塊: from oauth2client import _helpers [as 別名]
# 或者: from oauth2client._helpers import parse_unique_urlencoded [as 別名]
def do_GET(self):
        """Handle a GET request.

        Parses the query parameters and prints a message
        if the flow has completed. Note that we can't detect
        if an error occurred.
        """
        self.send_response(http_client.OK)
        self.send_header('Content-type', 'text/html')
        self.end_headers()
        parts = urllib.parse.urlparse(self.path)
        query = _helpers.parse_unique_urlencoded(parts.query)
        self.server.query_params = query
        self.wfile.write(
            b'<html><head><title>Authentication Status</title></head>')
        self.wfile.write(
            b'<body><p>The authentication flow has completed.</p>')
        self.wfile.write(b'</body></html>') 
開發者ID:taers232c,項目名稱:GAMADV-XTD,代碼行數:20,代碼來源:tools.py

示例2: _parse_exchange_token_response

# 需要導入模塊: from oauth2client import _helpers [as 別名]
# 或者: from oauth2client._helpers import parse_unique_urlencoded [as 別名]
def _parse_exchange_token_response(content):
    """Parses response of an exchange token request.

    Most providers return JSON but some (e.g. Facebook) return a
    url-encoded string.

    Args:
        content: The body of a response

    Returns:
        Content as a dictionary object. Note that the dict could be empty,
        i.e. {}. That basically indicates a failure.
    """
    resp = {}
    content = _helpers._from_bytes(content)
    try:
        resp = json.loads(content)
    except Exception:
        # different JSON libs raise different exceptions,
        # so we just do a catch-all here
        resp = _helpers.parse_unique_urlencoded(content)

    # some providers respond with 'expires', others with 'expires_in'
    if resp and 'expires' in resp:
        resp['expires_in'] = resp.pop('expires')

    return resp 
開發者ID:taers232c,項目名稱:GAMADV-XTD,代碼行數:29,代碼來源:client.py

示例3: test_without_repeats

# 需要導入模塊: from oauth2client import _helpers [as 別名]
# 或者: from oauth2client._helpers import parse_unique_urlencoded [as 別名]
def test_without_repeats(self):
        content = 'a=b&c=d'
        result = _helpers.parse_unique_urlencoded(content)
        self.assertEqual(result, {'a': 'b', 'c': 'd'}) 
開發者ID:openstack,項目名稱:deb-python-oauth2client,代碼行數:6,代碼來源:test__helpers.py

示例4: test_with_repeats

# 需要導入模塊: from oauth2client import _helpers [as 別名]
# 或者: from oauth2client._helpers import parse_unique_urlencoded [as 別名]
def test_with_repeats(self):
        content = 'a=b&a=d'
        with self.assertRaises(ValueError):
            _helpers.parse_unique_urlencoded(content) 
開發者ID:openstack,項目名稱:deb-python-oauth2client,代碼行數:6,代碼來源:test__helpers.py


注:本文中的oauth2client._helpers.parse_unique_urlencoded方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。