Skip to content

Commit c2ca079

Browse files
committed
.
1 parent 73486dc commit c2ca079

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

src/webson/_webson.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,9 +140,13 @@ async def get_contents_async(self, url: str, browser: Browser | None = None) ->
140140
"""
141141
if browser is None:
142142
async with async_playwright() as p:
143-
return await self._get_contents(url, p)
143+
contents = await self._get_contents(url, p)
144+
debug_logger.debug(f"Page contents: {contents[:100]}")
145+
return contents
144146
else:
145-
return await self._get_contents_with_browser(url, browser)
147+
contents = await self._get_contents_with_browser(url, browser)
148+
debug_logger.debug(f"Page contents: {contents[:100]}")
149+
return contents
146150

147151
async def _get_contents(self, url: str, playwright: AsyncPlaywright) -> str:
148152
"""Helper method to handle content retrieval with a new Playwright instance."""

tests/example.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ class EditaisResult(msgspec.Struct):
1717

1818
webson = Webson(llm=Synapse.of("google/genai/gemini-1.5-flash"))
1919

20-
url = "https://prosas.com.br/editais"
20+
result = webson.cast(EditaisResult, "https://prosas.com.br/editais")
2121

22-
casted = webson.cast(EditaisResult, url)
23-
24-
debug_logger.debug(casted)
22+
debug_logger.debug(result)

0 commit comments

Comments
 (0)