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

Helpers for httplib2.Http module.

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(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