Beispiel #1
0
 def define_request(self, request_builder, func_args, func_kwargs):
     request_builder.method = self._method
     request_builder.url = utils.URIBuilder(self._uri)
     self._argument_handler.handle_call(request_builder, func_args,
                                        func_kwargs)
     self._method_handler.handle_builder(request_builder)
     request_builder.url = request_builder.url.build()
Beispiel #2
0
    def __init__(self, client, converter_registry, base_url):
        self._method = None
        self._relative_url_template = utils.URIBuilder("")
        self._return_type = None
        self._client = client
        self._base_url = base_url

        # TODO: Pass this in as constructor parameter
        # TODO: Delegate instantiations to uplink.HTTPClientAdapter
        self._info = collections.defaultdict(dict)
        self._context = {}

        self._converter_registry = converter_registry
        self._transaction_hooks = []
        self._request_templates = []
Beispiel #3
0
 def test_remaining_variables(self):
     builder = utils.URIBuilder("{variable}")
     assert builder.remaining_variables() == set(["variable"])
     builder.set_variable(variable="resource")
     assert builder.remaining_variables() == set()
Beispiel #4
0
 def test_set_variable(self):
     builder = utils.URIBuilder("/path/to/{variable}")
     assert builder.build() == "/path/to/"
     builder.set_variable(variable="resource")
     assert builder.build() == "/path/to/resource"
Beispiel #5
0
 def uri(self, uri):
     self._uri_builder = utils.URIBuilder(uri)
Beispiel #6
0
 def relative_url(self, url):
     self._relative_url_template = utils.URIBuilder(url)