Skip to content

Commit

Permalink
Refactor post method in SoupPage class
Browse files Browse the repository at this point in the history
  • Loading branch information
mohamedmamdouh22 committed Jan 6, 2025
1 parent cbd98e4 commit a28a47a
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions sdk/harambe/contrib/soup/impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,25 +85,22 @@ class SoupResponseWithStatus:
status: int = res.status_code

return SoupResponseWithStatus()

async def post(self, url: str, data: dict[str, Any], **kwargs: Any) -> Any:
res = await self._session.post(
url,
headers=self._extra_headers,
data=data,
**kwargs
url, headers=self._extra_headers, data=data, **kwargs
)
if self._tracer:
self._tracer.log_request(res)

self._url = res.url
self._soup = BeautifulSoup(await res.text, "html.parser")

class SoupResponseWithStatus:
status: int = res.status

return SoupResponseWithStatus()

async def query_selector_all(self, selector: str) -> list[SoupElementHandle]:
return SoupElementHandle.from_tags(self._soup.select(selector))

Expand Down

0 comments on commit a28a47a

Please sign in to comment.