From 5f11c04fe504cf9a36b779bbb2b4bc8e7279b8f9 Mon Sep 17 00:00:00 2001 From: armadillo Date: Mon, 30 Oct 2023 08:05:51 +0000 Subject: [PATCH 1/2] Add pagination to screener requests --- yahooquery/base.py | 6 +++--- yahooquery/screener.py | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/yahooquery/base.py b/yahooquery/base.py index 54b8a0d..0412940 100644 --- a/yahooquery/base.py +++ b/yahooquery/base.py @@ -730,6 +730,7 @@ class _YahooFinance(object): "formatted": {"required": False, "default": False}, "scrIds": {"required": True, "default": None}, "count": {"required": False, "default": 25}, + "start": {"required": False, "default": 0}, }, }, "company360": { @@ -963,7 +964,7 @@ def country(self, country): def default_query_params(self): """ Dictionary containing default query parameters that are sent with - each request. The dictionary contains four keys: lang, region, + each request. The dictionary contains four keys: lang, region, corsDomain, and crumb Notes @@ -978,7 +979,7 @@ def default_query_params(self): if self.crumb is not None: params['crumb'] = self.crumb return params - + def login(self, username, password): ys = YahooSelenium(username=username, password=password) @@ -1216,4 +1217,3 @@ def _construct_data(self, json, response_field, **kwargs): data = json return data - \ No newline at end of file diff --git a/yahooquery/screener.py b/yahooquery/screener.py index 195408f..8ac8bff 100644 --- a/yahooquery/screener.py +++ b/yahooquery/screener.py @@ -65,7 +65,7 @@ def available_screeners(self): """ return list(SCREENERS.keys()) - def get_screeners(self, screen_ids, count=25): + def get_screeners(self, screen_ids, count=25, start=0): """Return list of predefined screeners from Yahoo Finance Parameters: @@ -76,4 +76,4 @@ def get_screeners(self, screen_ids, count=25): """ screen_ids = self._check_screen_ids(screen_ids) scrIds = [SCREENERS[screener]["id"] for screener in screen_ids] - return self._get_data("screener", params={"scrIds": scrIds, "count": count}) + return self._get_data("screener", params={"scrIds": scrIds, "count": count, "start": start}) From 80268dec79c839fea1232293f49c3d562a48a391 Mon Sep 17 00:00:00 2001 From: armadillo Date: Mon, 30 Oct 2023 08:13:43 +0000 Subject: [PATCH 2/2] bump project version --- pyproject.toml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 1773eb4..e0862d3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "yahooquery" -version = "2.3.3" +version = "2.3.4" description = "Python wrapper for an unofficial Yahoo Finance API" authors = ["Doug Guthrie "] documentation = "https://yahooquery.dpguthrie.com" @@ -15,8 +15,8 @@ pandas = "^2.0.3" requests-futures = "^1.0.1" tqdm = "^4.65.0" lxml = "^4.9.3" -selenium = {version = "^4.10.0", optional = true} -webdriver-manager = {version = "^3.8.6", optional = true} +selenium = { version = "^4.10.0", optional = true } +webdriver-manager = { version = "^3.8.6", optional = true } [tool.poetry.dev-dependencies] pytest = "^7.4.0"