MCPcopy Index your code
hub / github.com/googleapis/google-api-python-client / build_http

Function build_http

googleapiclient/http.py:1933–1962  ·  view source on GitHub ↗

Builds httplib2.Http object Returns: A httplib2.Http object, which is used to make http requests, and which has timeout set by default. To override default timeout call socket.setdefaulttimeout(timeout_in_sec) before interacting with this method.

()

Source from the content-addressed store, hash-verified

1931
1932
1933def build_http():
1934 """Builds httplib2.Http object
1935
1936 Returns:
1937 A httplib2.Http object, which is used to make http requests, and which has timeout set by default.
1938 To override default timeout call
1939
1940 socket.setdefaulttimeout(timeout_in_sec)
1941
1942 before interacting with this method.
1943 """
1944 if socket.getdefaulttimeout() is not None:
1945 http_timeout = socket.getdefaulttimeout()
1946 else:
1947 http_timeout = DEFAULT_HTTP_TIMEOUT_SEC
1948 http = httplib2.Http(timeout=http_timeout)
1949 # 308's are used by several Google APIs (Drive, YouTube)
1950 # for Resumable Uploads rather than Permanent Redirects.
1951 # This asks httplib2 to exclude 308s from the status codes
1952 # it treats as redirects
1953 try:
1954 http.redirect_codes = http.redirect_codes - {308}
1955 except AttributeError:
1956 # Apache Beam tests depend on this library and cannot
1957 # currently upgrade their httplib2 version
1958 # http.redirect_codes does not exist in previous versions
1959 # of httplib2, so pass
1960 pass
1961
1962 return http

Callers 15

document_apiFunction · 0.90
authorized_httpFunction · 0.90
initFunction · 0.90
buildFunction · 0.90
build_from_documentFunction · 0.90
document_apiFunction · 0.90
_dummy_zoo_requestMethod · 0.90

Calls

no outgoing calls

Used in the wild real call sites across dependent graphs

searching dependent graphs…