google.cloud.forseti.common.util.http_helpers module

Helpers for httplib2.Http module.

_set_user_agent(http, user_agent)[source]

Set the user-agent on every request.

Parameters:
  • http (object) – An instance of httplib2.Http or something that acts like it.
  • user_agent (string) – The value for the user-agent header.
Returns:

A modified instance of http that was passed in.

Return type:

httplib2.Http

build_http(http=None)[source]

Set custom Forseti user agent and timeouts on a new http object.

Parameters:http (object) – An instance of httplib2.Http, or compatible, used for testing.
Returns:An http object with the forseti user agent set.
Return type:httplib2.Http
set_user_agent_suffix(suffix)[source]

Set custom user agent string suffix. Once set, this suffix will be used in subsequent build_http() invocations.

Parameters:suffix (string) – Suffix to be appended to the custom user agent header.