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

Function new_request

googleapiclient/http.py:1851–1874  ·  view source on GitHub ↗

Modify the request headers to add the user-agent.

(
        uri,
        method="GET",
        body=None,
        headers=None,
        redirections=httplib2.DEFAULT_MAX_REDIRECTS,
        connection_type=None,
    )

Source from the content-addressed store, hash-verified

1849
1850 # The closure that will replace 'httplib2.Http.request'.
1851 def new_request(
1852 uri,
1853 method="GET",
1854 body=None,
1855 headers=None,
1856 redirections=httplib2.DEFAULT_MAX_REDIRECTS,
1857 connection_type=None,
1858 ):
1859 """Modify the request headers to add the user-agent."""
1860 if headers is None:
1861 headers = {}
1862 if "user-agent" in headers:
1863 headers["user-agent"] = user_agent + " " + headers["user-agent"]
1864 else:
1865 headers["user-agent"] = user_agent
1866 resp, content = request_orig(
1867 uri,
1868 method=method,
1869 body=body,
1870 headers=headers,
1871 redirections=redirections,
1872 connection_type=connection_type,
1873 )
1874 return resp, content
1875
1876 http.request = new_request
1877 return http

Callers

nothing calls this directly

Calls 1

getMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…