Open igorya7v opened 1 year ago
This is too much work to fix for the upcoming release. Clearly calling the asynchronous implementation from a synchronous context isn't working for every situation.
Can you please call async def invoke_method_async
instead?
We basically need synchronous method implementation of DaprHttpClient
and then use that in the invoke_method
implementation in DaprInvocationHttpClient
. And we need additional tests for this.
For the time being, please use the example shown here which uses Python requests
directly for a basic service invocation call. As long as you set the dapr-app-id header and specify the sidecar address as destination, any path will be routed to the target app and invoked accordingly. There is no need to use the Python SDK.
https://github.com/dapr/quickstarts/blob/master/service_invocation/python/http/checkout/app.py
When the loop is already running, the following line will raise the
RuntimeError: This event loop is already running
:https://github.com/dapr/python-sdk/blob/033acbc92b4c4b40577c603aa5b03694eb74e295/dapr/clients/http/dapr_invocation_http_client.py#L161
This happens when the following line returns an already running loop:
https://github.com/dapr/python-sdk/blob/033acbc92b4c4b40577c603aa5b03694eb74e295/dapr/clients/http/dapr_invocation_http_client.py#L147