From 59a2343a40bc7818b69b872c683b123a80f521e1 Mon Sep 17 00:00:00 2001 From: kasparasizi1 <132673909+kasparasizi1@users.noreply.github.com> Date: Thu, 23 Jul 2026 12:11:08 +0300 Subject: [PATCH] feat(flights): add sort_by (top|price) for full price-sorted inventory sort_by='price' returns the FULL GetShoppingResults inventory (every carrier, the cheap long-layover fares) plus Google's price floor / typical range / history. Default 'top' keeps the fast best-picks behaviour. Bumps 0.21.0 -> 0.22.0. --- CHANGELOG.md | 6 ++++++ pyproject.toml | 2 +- src/scrapebadger/__init__.py | 2 +- src/scrapebadger/_internal/client.py | 2 +- src/scrapebadger/google/flights.py | 9 +++++++++ uv.lock | 2 +- 6 files changed, 19 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index af05dc6..6c907ff 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.22.0] - 2026-07-23 + +### Added + +- **Google Flights `sort_by`** — `client.google.flights.search(..., sort_by="price")` now returns the FULL price-sorted inventory (every carrier, the cheap long-layover fares) plus Google's own price floor, typical range, and price history, instead of only the ~6-8 "best" preview. Default `sort_by="top"` keeps the fast best-picks behaviour. (SCR-123) + ## [0.21.0] - 2026-07-17 ### Added diff --git a/pyproject.toml b/pyproject.toml index 2afb336..8da7b9a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "scrapebadger" -version = "0.21.0" +version = "0.22.0" description = "Official Python SDK for ScrapeBadger - Async web scraping APIs for Twitter and more" readme = "README.md" license = { text = "MIT" } diff --git a/src/scrapebadger/__init__.py b/src/scrapebadger/__init__.py index 5ccd968..3804167 100644 --- a/src/scrapebadger/__init__.py +++ b/src/scrapebadger/__init__.py @@ -863,7 +863,7 @@ async def main(): ZestimateHistoryPoint as ZillowZestimateHistoryPoint, ) -__version__ = "0.21.0" +__version__ = "0.22.0" __all__ = [ # TikTok core models diff --git a/src/scrapebadger/_internal/client.py b/src/scrapebadger/_internal/client.py index f03b56c..6e5b4fd 100644 --- a/src/scrapebadger/_internal/client.py +++ b/src/scrapebadger/_internal/client.py @@ -29,7 +29,7 @@ T = TypeVar("T") # User agent for SDK requests -SDK_VERSION = "0.20.0" +SDK_VERSION = "0.22.0" USER_AGENT = f"scrapebadger-python/{SDK_VERSION}" diff --git a/src/scrapebadger/google/flights.py b/src/scrapebadger/google/flights.py index a4e235a..50f0018 100644 --- a/src/scrapebadger/google/flights.py +++ b/src/scrapebadger/google/flights.py @@ -11,6 +11,7 @@ TripType = Literal["round_trip", "one_way", "multi_city"] TravelClass = Literal["economy", "premium_economy", "business", "first"] StopsFilter = Literal["any", "nonstop", "one_stop", "two_stops"] +SortBy = Literal["top", "price"] class FlightsClient: @@ -60,6 +61,7 @@ async def search( hl: str = "en", stops: StopsFilter = "any", max_price: int | None = None, + sort_by: SortBy = "top", ) -> dict[str, Any]: """Search Google Flights for available itineraries. @@ -80,6 +82,12 @@ async def search( hl: Language code. stops: Max stops filter. max_price: Upper price filter. + sort_by: "top" (default) returns Google's ~6-8 "best" picks + (fast). "price" returns the FULL price-sorted inventory + (every carrier, the cheap long-layover fares) plus Google's + own price floor, typical range, and price history — slower, + and falls back to the "top" set under load. Round-trip + initial search only. Returns: Response with `best_flights[]`, `other_flights[]`, @@ -99,6 +107,7 @@ async def search( "gl": gl, "hl": hl, "stops": stops, + "sort_by": sort_by, } if return_date is not None: params["return_date"] = return_date diff --git a/uv.lock b/uv.lock index 220facc..074f00b 100644 --- a/uv.lock +++ b/uv.lock @@ -752,7 +752,7 @@ wheels = [ [[package]] name = "scrapebadger" -version = "0.21.0" +version = "0.22.0" source = { editable = "." } dependencies = [ { name = "httpx" },