diff --git a/dapr/clients/__init__.py b/dapr/clients/__init__.py index da5f373b..4586b040 100644 --- a/dapr/clients/__init__.py +++ b/dapr/clients/__init__.py @@ -79,8 +79,7 @@ def __init__( if http_timeout_seconds is None: http_timeout_seconds = settings.DAPR_HTTP_TIMEOUT_SECONDS self.invocation_client = DaprInvocationHttpClient(headers_callback=headers_callback, - timeout=http_timeout_seconds, - address=address) + timeout=http_timeout_seconds) elif invocation_protocol == 'GRPC': pass else: diff --git a/dapr/clients/http/client.py b/dapr/clients/http/client.py index da66ea30..d0f178b2 100644 --- a/dapr/clients/http/client.py +++ b/dapr/clients/http/client.py @@ -37,8 +37,7 @@ class DaprHttpClient: def __init__(self, message_serializer: 'Serializer', timeout: Optional[int] = 60, - headers_callback: Optional[Callable[[], Dict[str, str]]] = None, - address: Optional[str] = None): + headers_callback: Optional[Callable[[], Dict[str, str]]] = None): """Invokes Dapr over HTTP. Args: @@ -49,15 +48,12 @@ def __init__(self, self._timeout = aiohttp.ClientTimeout(total=timeout) self._serializer = message_serializer self._headers_callback = headers_callback - self._address = address def get_api_url(self) -> str: - if self._address: - return '{}/{}'.format(self._address, settings.DAPR_API_VERSION) if settings.DAPR_HTTP_ENDPOINT: return '{}/{}'.format(settings.DAPR_HTTP_ENDPOINT, settings.DAPR_API_VERSION) - else: - return 'http://{}:{}/{}'.format(settings.DAPR_RUNTIME_HOST, + + return 'http://{}:{}/{}'.format(settings.DAPR_RUNTIME_HOST, settings.DAPR_HTTP_PORT, settings.DAPR_API_VERSION) async def send_bytes( diff --git a/dapr/clients/http/dapr_invocation_http_client.py b/dapr/clients/http/dapr_invocation_http_client.py index 0010fad5..af965639 100644 --- a/dapr/clients/http/dapr_invocation_http_client.py +++ b/dapr/clients/http/dapr_invocation_http_client.py @@ -34,15 +34,14 @@ class DaprInvocationHttpClient: def __init__( self, timeout: int = 60, - headers_callback: Optional[Callable[[], Dict[str, str]]] = None, - address: Optional[str] = None): + headers_callback: Optional[Callable[[], Dict[str, str]]] = None): """Invokes Dapr's API for method invocation over HTTP. Args: timeout (int, optional): Timeout in seconds, defaults to 60. headers_callback (lambda: Dict[str, str]], optional): Generates header for each request. """ - self._client = DaprHttpClient(DefaultJSONSerializer(), timeout, headers_callback, address) + self._client = DaprHttpClient(DefaultJSONSerializer(), timeout, headers_callback) async def invoke_method_async( self,