From 1a5ed90fc1fc90801fb286c623dff8a14c5dbf24 Mon Sep 17 00:00:00 2001 From: Edward Betts Date: Sat, 25 Nov 2023 16:04:35 +0000 Subject: [PATCH 1/3] Request UK version of Google Closes: #2 --- google_stocks/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/google_stocks/__init__.py b/google_stocks/__init__.py index dbdb0fa..f0c24f2 100644 --- a/google_stocks/__init__.py +++ b/google_stocks/__init__.py @@ -81,7 +81,8 @@ class Index: @property def search_url(self) -> str: """Search URL.""" - return "https://www.google.com/search?q=" + urllib.parse.quote_plus(self.name) + q = urllib.parse.quote_plus(self.name) + return f"https://www.google.com/search?q={q}&gl=uk" def run(self, playwright: Playwright) -> None: """Run playwright.""" From 4638c710d5769de9d1945576e4cdaf7f6627096e Mon Sep 17 00:00:00 2001 From: Edward Betts Date: Sat, 25 Nov 2023 16:05:17 +0000 Subject: [PATCH 2/3] Don't include bad state in one line output --- google_stocks/__init__.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/google_stocks/__init__.py b/google_stocks/__init__.py index f0c24f2..24a6cbb 100644 --- a/google_stocks/__init__.py +++ b/google_stocks/__init__.py @@ -146,7 +146,4 @@ class Index: @property def one_line(self) -> str: """Index name, price and price change.""" - return ( - f"{self.title}: {self.price} ({self.percent_change}%) " - + f"{self.state} {self.timestamp}" - ) + return f"{self.title}: {self.price} ({self.percent_change}%) {self.timestamp}" From e5225ba239668072291d2d65e8ef53a873c941c2 Mon Sep 17 00:00:00 2001 From: Edward Betts Date: Sat, 25 Nov 2023 16:06:16 +0000 Subject: [PATCH 3/3] Fix search for S&P Total Market --- s_and_p_total_market | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/s_and_p_total_market b/s_and_p_total_market index bfcfdc0..e1e22d6 100755 --- a/s_and_p_total_market +++ b/s_and_p_total_market @@ -3,6 +3,6 @@ from google_stocks import Index -index = Index("S&P Total Market") +index = Index("SPTMI") print(index.one_line)