google.appengine.api.urlfetch_stub.URLFetchServiceStub

Stub version of the urlfetch API to be used with apiproxy_stub_map.

Inherits From: APIProxyStub, expected_type

service_name Service name expected for all calls.
urlmatchers_to_fetch_functions A list of two-element tuples. The first element is a urlmatcher predicate function that takes a url and determines a match. The second is a function that can retrieve result for that url. If no match is found, a url is handled by the default _RetrieveURL function. When more than one match is possible, the first match is used.

Methods

CreateRPC

View source

Creates RPC object instance.

Returns
An instance of RPC.

MakeSyncCall

View source

The main RPC entry point.

Args
service Must be name as provided to service_name of constructor.
call A string representing the rpc to make. Must be part of the underlying services methods and impemented by _Dynamic_<call>.
request A protocol buffer of the type corresponding to call.
response A protocol buffer of the type corresponding to call.
request_id A unique string identifying the request associated with the API call.

SetError

View source

Set an error condition that may be raised when calls made to stub.

If a method is specified, the error will only apply to that call. The error rate is applied to the method specified or all calls if method is not set.

Args
error An instance of apiproxy_errors.Error or None for no error.
method A string representing the method that the error will affect.
error_rate a number from [0, 1] that sets the chance of the error, defaults to 1.

THREADSAFE True