警告非常烦人。
这是一个补丁。它也适用于 urllib2、urllib3 和 Requests。
from google.appengine.api import urlfetch
urlfetch.fetch_body = urlfetch.fetch
def fetch_patch(url, payload=None, method=1, headers={},
allow_truncated=False, follow_redirects=True,
deadline=None, validate_certificate=None):
if headers and headers.get('Content-Length', None):
del headers['Content-Length']
if headers and headers.get('Host', None):
del headers['Host']
return urlfetch.fetch_body(url, payload, method, headers,
allow_truncated, follow_redirects,
deadline, validate_certificate)
urlfetch.fetch = fetch_patch