|  |  | 
__builtin__.object
HttpRequest
RequestMockBuilder
 
 
| class HttpRequest(__builtin__.object)
 |  |  | Encapsulates a single HTTP request. 
 |  |  | Methods defined here: 
 __init__(self, http, postproc, uri, method='GET', body=None, headers=None, methodId=None)Constructor for an HttpRequest.
 Args:
 http: httplib2.Http, the transport object to use to make a request
 postproc: callable, called on the HTTP response and content to transform
 it into a data object before returning, or raising an exception
 on an error.
 uri: string, the absolute URI to send the request to
 method: string, the HTTP method to use
 body: string, the request body of the HTTP request
 headers: dict, the HTTP request headers
 methodId: string, a unique identifier for the API method being called.
 execute(self, http=None)Execute the request.
 Args:
 http: httplib2.Http, an http object to be used in place of the
 one the HttpRequest request object was constructed with.
 
 Returns:
 A deserialized object model of the response body as determined
 by the postproc.
 
 Raises:
 apiclient.errors.HttpError if the response was not a 2xx.
 httplib2.Error if a transport error has occured.
 Data descriptors defined here:
 
 __dict__dictionary for instance variables (if defined)
 __weakref__list of weak references to the object (if defined)
 |  
 
| class RequestMockBuilder(__builtin__.object)
 |  |  | A simple mock of HttpRequest 
 Pass in a dictionary to the constructor that maps request methodIds to
 tuples of (httplib2.Response, content) that should be returned when that
 method is called. None may also be passed in for the httplib2.Response, in
 which case a 200 OK response will be generated.
 
 Example:
 response = '{"data": {"id": "tag:google.c...'
 requestBuilder = RequestMockBuilder(
 {
 'chili.activities.get': (None, response),
 }
 )
 apiclient.discovery.build("buzz", "v1", requestBuilder=requestBuilder)
 
 Methods that you do not supply a response for will return a
 200 OK with an empty string as the response content. The methodId
 is taken from the rpcName in the discovery document.
 
 For more details see the project wiki.
 
 |  |  | Methods defined here: 
 __call__(self, http, postproc, uri, method='GET', body=None, headers=None, methodId=None)Implements the callable interface that discovery.build() expectsof requestBuilder, which is to build an object compatible with
 HttpRequest.execute(). See that method for the description of the
 parameters and the expected response.
 __init__(self, responses)Constructor for RequestMockBuilder
 The constructed object should be a callable object
 that can replace the class HttpResponse.
 
 responses - A dictionary that maps methodIds into tuples
 of (httplib2.Response, content). The methodId
 comes from the 'rpcName' field in the discovery
 document.
 Data descriptors defined here:
 
 __dict__dictionary for instance variables (if defined)
 __weakref__list of weak references to the object (if defined)
 |  |