本文整理匯總了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