本文整理汇总了Python中google3.apphosting.api.urlfetch.fetch方法的典型用法代码示例。如果您正苦于以下问题:Python urlfetch.fetch方法的具体用法?Python urlfetch.fetch怎么用?Python urlfetch.fetch使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类google3.apphosting.api.urlfetch
的用法示例。
在下文中一共展示了urlfetch.fetch方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _new_fixed_fetch
# 需要导入模块: from google3.apphosting.api import urlfetch [as 别名]
# 或者: from google3.apphosting.api.urlfetch import fetch [as 别名]
def _new_fixed_fetch(validate_certificate):
def fixed_fetch(url, payload=None, method="GET", headers={},
allow_truncated=False, follow_redirects=True,
deadline=None):
if deadline is None:
deadline = socket.getdefaulttimeout() or 5
return fetch(url, payload=payload, method=method, headers=headers,
allow_truncated=allow_truncated,
follow_redirects=follow_redirects, deadline=deadline,
validate_certificate=validate_certificate)
return fixed_fetch
示例2: _new_fixed_fetch
# 需要导入模块: from google3.apphosting.api import urlfetch [as 别名]
# 或者: from google3.apphosting.api.urlfetch import fetch [as 别名]
def _new_fixed_fetch(validate_certificate):
def fixed_fetch(url, payload=None, method="GET", headers={},
allow_truncated=False, follow_redirects=True,
deadline=5):
return fetch(url, payload=payload, method=method, headers=headers,
allow_truncated=allow_truncated,
follow_redirects=follow_redirects, deadline=deadline,
validate_certificate=validate_certificate)
return fixed_fetch