Skip to content

Commit

Permalink
Fix class names, missing await and useless return
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexMili committed Oct 8, 2024
1 parent 8c67a8d commit 205c0bc
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions src/reachable/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ async def request(
page = await self.browser.new_page()

# Register the route to block specific resources
await page.route("**/*", AsyncPlaywright.block_resources)
await page.route("**/*", AsyncPlaywrightClient.block_resources)

# Handler to track outgoing requests and handle redirects
async def request_handler(request):
Expand Down Expand Up @@ -406,25 +406,23 @@ async def response_handler(response):

return resp

def get(
async def get(
self, url: str, ssl_fallback_to_http: bool = False
) -> Optional[httpx.Response]:
return self.request("get", url, ssl_fallback_to_http=ssl_fallback_to_http)
return await self.request("get", url, ssl_fallback_to_http=ssl_fallback_to_http)

def post(
async def post(
self, url: str, ssl_fallback_to_http: bool = False
) -> Optional[httpx.Response]:
logging.warning(
"Using Playwright client, all requests are GET requests through the browser"
)
return self.request("get", url, ssl_fallback_to_http=ssl_fallback_to_http)
return await self.request("get", url, ssl_fallback_to_http=ssl_fallback_to_http)

def head(
async def head(
self, url: str, ssl_fallback_to_http: bool = False
) -> Optional[httpx.Response]:
logging.warning(
"Using Playwright client, all requests are GET requests through the browser"
)
return self.request("get", url, ssl_fallback_to_http=ssl_fallback_to_http)

return await self.request("head", url, headers, include_host)
return await self.request("get", url, ssl_fallback_to_http=ssl_fallback_to_http)

0 comments on commit 205c0bc

Please sign in to comment.