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

Function authorized_http

googleapiclient/_auth.py:100–124  ·  view source on GitHub ↗

Returns an http client that is authorized with the given credentials. Args: credentials (Union[ google.auth.credentials.Credentials, oauth2client.client.Credentials]): The credentials to use. Returns: Union[httplib2.Http, google_auth_httplib2.Authori

(credentials)

Source from the content-addressed store, hash-verified

98
99
100def authorized_http(credentials):
101 """Returns an http client that is authorized with the given credentials.
102
103 Args:
104 credentials (Union[
105 google.auth.credentials.Credentials,
106 oauth2client.client.Credentials]): The credentials to use.
107
108 Returns:
109 Union[httplib2.Http, google_auth_httplib2.AuthorizedHttp]: An
110 authorized http client.
111 """
112 from googleapiclient.http import build_http
113
114 if HAS_GOOGLE_AUTH and isinstance(credentials, google.auth.credentials.Credentials):
115 if google_auth_httplib2 is None:
116 raise ValueError(
117 "Credentials from google.auth specified, but "
118 "google-api-python-client is unable to use these credentials "
119 "unless google-auth-httplib2 is installed. Please install "
120 "google-auth-httplib2."
121 )
122 return google_auth_httplib2.AuthorizedHttp(credentials, http=build_http())
123 else:
124 return credentials.authorize(build_http())
125
126
127def refresh_credentials(credentials):

Callers

nothing calls this directly

Calls 2

build_httpFunction · 0.90
authorizeMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…