From 856365526b222584cfc70cfcdfd5aa2dbe55061b Mon Sep 17 00:00:00 2001 From: AG3NTZ3R0 Date: Thu, 15 Feb 2024 19:24:13 -0500 Subject: [PATCH] Updates PyLint workflow and applies recommendations --- .github/workflows/pylint.yml | 4 ++-- src/cnbc/default.py | 4 ++-- src/cnbc/market.py | 2 +- src/cnbc/news.py | 6 +++--- src/cnbc/symbol.py | 16 ++++++++-------- 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/.github/workflows/pylint.yml b/.github/workflows/pylint.yml index 03a163b..d0926a5 100644 --- a/.github/workflows/pylint.yml +++ b/.github/workflows/pylint.yml @@ -7,7 +7,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ["3.10"] + python-version: ["3.12"] steps: - uses: actions/checkout@v3 - name: Set up Python ${{ matrix.python-version }} @@ -20,4 +20,4 @@ jobs: pip install pylint - name: Analysing the code with pylint run: | - pylint $(git ls-files '*.py') --fail-under=9.0 + pylint $(git ls-files '*.py') --fail-under=8.0 diff --git a/src/cnbc/default.py b/src/cnbc/default.py index 9a9a984..e8d23f0 100644 --- a/src/cnbc/default.py +++ b/src/cnbc/default.py @@ -15,7 +15,7 @@ def get_metadata(api_key: str): 'x-rapidapi-key': api_key } - response = requests.request("GET", url, headers=headers).json() + response = requests.request("GET", url, headers=headers, timeout=10).json() return response @@ -38,6 +38,6 @@ def auto_complete(query: str, api_key: str): 'x-rapidapi-key': api_key } - response = requests.request("GET", url, headers=headers, params=querystring).json() + response = requests.request("GET", url, headers=headers, params=querystring, timeout=10).json() return response diff --git a/src/cnbc/market.py b/src/cnbc/market.py index 135f5ee..fe405e8 100644 --- a/src/cnbc/market.py +++ b/src/cnbc/market.py @@ -13,6 +13,6 @@ def list_indices(api_key: str): 'x-rapidapi-key': api_key } - response = requests.request("GET", url, headers=headers).json() + response = requests.request("GET", url, headers=headers, timeout=10).json() return response diff --git a/src/cnbc/news.py b/src/cnbc/news.py index 007f0b0..f40eacc 100644 --- a/src/cnbc/news.py +++ b/src/cnbc/news.py @@ -20,7 +20,7 @@ def list_trending_news(count: str, api_key: str): 'x-rapidapi-key': api_key } - response = requests.request("GET", url, headers=headers, params=querystring).json() + response = requests.request("GET", url, headers=headers, params=querystring, timeout=10).json() return response @@ -45,7 +45,7 @@ def list_special_reports(api_key: str, page: str = 1, page_size: str = 25, ): 'x-rapidapi-key': api_key } - response = requests.request("GET", url, headers=headers, params=querystring).json() + response = requests.request("GET", url, headers=headers, params=querystring, timeout=10).json() return response @@ -72,6 +72,6 @@ def list_symbol_news(symbol: str, api_key: str, page: str = 1, page_size: str = 'x-rapidapi-key': api_key } - response = requests.request("GET", url, headers=headers, params=querystring).json() + response = requests.request("GET", url, headers=headers, params=querystring, timeout=10).json() return response diff --git a/src/cnbc/symbol.py b/src/cnbc/symbol.py index ddf2d31..8188990 100644 --- a/src/cnbc/symbol.py +++ b/src/cnbc/symbol.py @@ -21,7 +21,7 @@ def get_earnings_chart(issue_id: str, num_of_years: str, api_key: str): 'x-rapidapi-key': api_key } - response = requests.request("GET", url, headers=headers, params=querystring).json() + response = requests.request("GET", url, headers=headers, params=querystring, timeout=10).json() return response @@ -44,7 +44,7 @@ def get_profile(issue_id: str, api_key: str): 'x-rapidapi-key': api_key } - response = requests.request("GET", url, headers=headers, params=querystring).json() + response = requests.request("GET", url, headers=headers, params=querystring, timeout=10).json() return response @@ -69,7 +69,7 @@ def get_chart(issue_id: str, interval: str, api_key: str): 'x-rapidapi-key': api_key } - response = requests.request("GET", url, headers=headers, params=querystring).json() + response = requests.request("GET", url, headers=headers, params=querystring, timeout=10).json() return response @@ -92,7 +92,7 @@ def translate(symbol: str, api_key: str): 'x-rapidapi-key': api_key } - response = requests.request("GET", url, headers=headers, params=querystring).json() + response = requests.request("GET", url, headers=headers, params=querystring, timeout=10).json() return response @@ -115,7 +115,7 @@ def get_summary(issue_ids: str, api_key: str): 'x-rapidapi-key': api_key } - response = requests.request("GET", url, headers=headers, params=querystring).json() + response = requests.request("GET", url, headers=headers, params=querystring, timeout=10).json() return response @@ -138,7 +138,7 @@ def get_fundamentals(issue_ids: str, api_key: str): 'x-rapidapi-key': api_key } - response = requests.request("GET", url, headers=headers, params=querystring).json() + response = requests.request("GET", url, headers=headers, params=querystring, timeout=10).json() return response @@ -163,7 +163,7 @@ def get_priceline_chart(issue_id: str, num_of_days: str, api_key: str): 'x-rapidapi-key': api_key } - response = requests.request("GET", url, headers=headers, params=querystring).json() + response = requests.request("GET", url, headers=headers, params=querystring, timeout=10).json() return response @@ -186,6 +186,6 @@ def get_peers(symbol: str, api_key: str): 'x-rapidapi-key': api_key } - response = requests.request("GET", url, headers=headers, params=querystring).json() + response = requests.request("GET", url, headers=headers, params=querystring, timeout=10).json() return response