Skip to content

Automate browser based workflows with AI

add async http client (#760)

Shuchang Zheng1ef67f9fcd5e
diff --git a/skyvern/forge/sdk/core/async_http_client.py b/skyvern/forge/sdk/core/async_http_client.py
new file mode 100644
index 000000000..95e053d58
--- /dev/null
+++ b/skyvern/forge/sdk/core/async_http_client.py
@@ -0,0 +1,24 @@
+from typing import Any
+
+import httpx
+
+
+class AsyncHttpClient:
+ """
+ A wrapper of httpx client.
+ Functionalities:
+ 1. It comes with a default httpx.AsyncClient instance.
+ 2. The httx client could be replaced by a set_client method.
+ """
+
+ def __init__(self, proxy: str | None = None) -> None:
+ self.client = httpx.AsyncClient(proxy=proxy)
+
+ async def get(self, url: str) -> httpx.Response:
+ return await self.client.get(url)
+
+ async def post(self, url: str, data: dict[Any, Any] | None = None) -> httpx.Response:
+ return await self.client.post(url, data=data)
+
+ async def close(self) -> None:
+ await self.client.aclose()