Skip to content

Commit

Permalink
Fix(integrations-service): Change to asynchronous methods
Browse files Browse the repository at this point in the history
  • Loading branch information
HamadaSalhab committed Oct 1, 2024
1 parent aeb20a8 commit c1828e6
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@


@router.post("/execute/{provider}", tags=["execution"])
def execute(
async def execute(
provider: IdentifierName,
data: ExecutionRequest,
) -> ExecutionResponse:
try:
return execute_integration(
return await execute_integration(
provider=provider, arguments=data.arguments, setup=data.setup
)
except ValueError as e:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from ..providers import providers


def execute_integration(
async def execute_integration(
provider: IdentifierName,
arguments: ExecutionArguments,
method: IdentifierName | None = None,
Expand All @@ -32,6 +32,6 @@ def execute_integration(
parsed_arguments = arguments_class(**arguments.model_dump())

if setup:
return execution_function(setup=setup, arguments=parsed_arguments)
return await execution_function(setup=setup, arguments=parsed_arguments)
else:
return execution_function(arguments=parsed_arguments)
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from ...models import BraveSearchArguments, BraveSearchOutput, BraveSearchSetup


def search(
async def search(
setup: BraveSearchSetup, arguments: BraveSearchArguments
) -> BraveSearchOutput:
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from ...models import BrowserBaseLoadArguments, BrowserBaseLoadOutput, BrowserBaseSetup


def load(
async def load(
setup: BrowserBaseSetup, arguments: BrowserBaseLoadArguments
) -> BrowserBaseLoadOutput:
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from ...models import HackerNewsFetchArguments, HackerNewsFetchOutput


def fetch(arguments: HackerNewsFetchArguments) -> HackerNewsFetchOutput:
async def fetch(arguments: HackerNewsFetchArguments) -> HackerNewsFetchOutput:
"""
Fetches and formats content from a Hacker News thread using the provided URL.
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from ...models import SpiderFetchArguments, SpiderFetchOutput, SpiderSetup


def crawl(setup: SpiderSetup, arguments: SpiderFetchArguments) -> SpiderFetchOutput:
async def crawl(setup: SpiderSetup, arguments: SpiderFetchArguments) -> SpiderFetchOutput:
"""
Fetches data from a specified URL.
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from ...models import WeatherGetArguments, WeatherGetOutput, WeatherSetup


def get(setup: WeatherSetup, arguments: WeatherGetArguments) -> WeatherGetOutput:
async def get(setup: WeatherSetup, arguments: WeatherGetArguments) -> WeatherGetOutput:
"""
Fetches weather data for a specified location using OpenWeatherMap API.
"""
Expand Down

0 comments on commit c1828e6

Please sign in to comment.