Skip to content

Commit

Permalink
fix(agents-api): Fix execute_api_call to use async httpx and pass hea…
Browse files Browse the repository at this point in the history
…ders back

Signed-off-by: Diwank Singh Tomer <[email protected]>
  • Loading branch information
creatorrr committed Oct 4, 2024
1 parent 3154d85 commit 326067a
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions agents-api/agents_api/activities/excecute_api_call.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,18 @@ async def execute_api_call(
request_args: RequestArgs,
) -> Any:
try:
response = httpx.request(
method=api_call.method,
url=str(api_call.url),
headers=api_call.headers,
follow_redirects=api_call.follow_redirects,
**request_args,
)
async with httpx.AsyncClient() as client:
response = await client.request(
method=api_call.method,
url=str(api_call.url),
headers=api_call.headers,
follow_redirects=api_call.follow_redirects,
**request_args,
)

response_dict = {
"status_code": response.status_code,
# FIXME: We need to handle the headers properly and convert them to a plain dict
# "headers": response.headers,
"headers": dict(response.headers),
"content": response.content,
"json": response.json(),
}
Expand Down

0 comments on commit 326067a

Please sign in to comment.