Skip to content

Possibility of using local Playwright#43

Merged
AWeirdDev merged 3 commits intoAWeirdDev:mainfrom
kiinami:local
Mar 5, 2025
Merged

Possibility of using local Playwright#43
AWeirdDev merged 3 commits intoAWeirdDev:mainfrom
kiinami:local

Conversation

@kiinami
Copy link
Copy Markdown
Contributor

@kiinami kiinami commented Mar 5, 2025

I am getting a 401 error when using the fallback method lately, most possibly because I made too many requests to the serverless Playwright!

So, I implemented a way of using good old local Playwright optionally.

The most important changes include updates to the documentation, core functions, and the addition of a new module to handle local Playwright fetching, as well as the inclusion of Playwright as an optional dependency.

  • Documentation Update:

    • docs/local.md: Added instructions for running Playwright locally, including installation steps and usage examples.
  • Core Function Updates:

    • fast_flights/core.py: Added "local" as a valid mode for get_flights and get_flights_from_filter functions, and implemented the logic to handle the "local" mode by calling a new function from the local_playwright module. [1] [2] [3]
  • New Module:

    • fast_flights/local_playwright.py: Created a new module to fetch flight data using Playwright locally, including an asynchronous function to interact with the browser and a synchronous function to fetch data based on provided parameters. It also sidesteps the cookie modal with the most amazing method of clicking on 'Accept all'.
  • Dependencies:

    • pyproject.toml: Added an optional dependency for Playwright, allowing users to install it when they need to run Playwright locally. This should play nicely with pip, and attempting to install it locally with the [local] thing at the end worked, but I have no idea if it will work when the package is on PyPI (although, again, it should).

Thank you for this amazing project, it is really useful :)

@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. documentation Improvements or additions to documentation enhancement New feature or request labels Mar 5, 2025
Copy link
Copy Markdown
Owner

@AWeirdDev AWeirdDev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is awesome.

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Mar 5, 2025
@AWeirdDev AWeirdDev merged commit 4a0031c into AWeirdDev:main Mar 5, 2025
jimmyliu03 pushed a commit to jimmyliu03/google-flights that referenced this pull request Dec 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation enhancement New feature or request lgtm This PR has been approved by a maintainer size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants