Skip to content

Commit

Permalink
Updates PyLint workflow and applies recommendations
Browse files Browse the repository at this point in the history
  • Loading branch information
AG3NTZ3R0 committed Feb 16, 2024
1 parent c5b20dc commit 5a10ad8
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 21 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/pylint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand All @@ -17,7 +17,8 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install requests
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
4 changes: 2 additions & 2 deletions src/cnbc/default.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
2 changes: 1 addition & 1 deletion src/cnbc/market.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 3 additions & 3 deletions src/cnbc/news.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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

Expand All @@ -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
16 changes: 8 additions & 8 deletions src/cnbc/symbol.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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

Expand All @@ -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

Expand All @@ -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

Expand All @@ -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

Expand All @@ -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

Expand All @@ -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

Expand All @@ -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
2 changes: 1 addition & 1 deletion tests/test_default.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import os
import unittest

from src.cnbc.default import *
from src.cnbc import get_metadata, auto_complete


class TestDefaultEndpoints(unittest.TestCase):
Expand Down
3 changes: 1 addition & 2 deletions tests/test_market.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import os
import unittest


from src.cnbc.market import *
from src.cnbc import list_indices


class TestMarketEndpoints(unittest.TestCase):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_news.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import os
import unittest

from src.cnbc.news import *
from src.cnbc import list_trending_news, list_special_reports, list_symbol_news


class TestNewsEndpoints(unittest.TestCase):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_symbol.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import os
import unittest

from src.cnbc.symbol import *
from src.cnbc import get_earnings_chart, get_profile, get_chart, translate, get_summary, get_fundamentals, get_priceline_chart, get_peers


class TestSymbolEndpoints(unittest.TestCase):
Expand Down

0 comments on commit 5a10ad8

Please sign in to comment.