当前位置: 首页>>代码示例>>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;未经允许,请勿转载。