Skip to content

Commit

Permalink
Merge pull request #21
Browse files Browse the repository at this point in the history
SSL Verify Fix and Auto Version Bump
  • Loading branch information
arpandaze authored Feb 15, 2024
2 parents 970b1d9 + 2e83a3f commit 609d18a
Show file tree
Hide file tree
Showing 6 changed files with 409 additions and 392 deletions.
20 changes: 16 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,35 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3.3.0
uses: actions/checkout@v3
with:
lfs: true
fetch-depth: 0
ref: main

- name: Set ENV
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV

- name: Install Poetry
run: pipx install poetry
run: |
pipx install poetry
poetry self add poetry-bumpversion
- name: Setup Python
uses: actions/[email protected]
with:
python-version: "3.11"
cache: 'poetry'

- name: Bump package version
run: poetry version $(echo "${{ env.RELEASE_VERSION }}" | sed 's/v//')

- name: Commit and push version bump
run: |
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config user.name "github-actions[bot]"
git add -u
git commit -m "chore(release): ${{ env.RELEASE_VERSION }} release"
git push
- name: Install Dependencies
run: poetry install

Expand Down
2 changes: 1 addition & 1 deletion nepseutils/constants.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
USER_AGENT = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Safari/537.36 Edg/104.0.1293.70"
USER_AGENT = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36"

MS_API_BASE = "https://webbackend.cdsc.com.np/api"

Expand Down
7 changes: 6 additions & 1 deletion nepseutils/core/account.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from tenacity.stop import stop_after_attempt
from tenacity.wait import wait_fixed

from nepseutils.constants import MS_API_BASE
from nepseutils.constants import BASE_HEADERS, MS_API_BASE
from nepseutils.utils.decorators import autosave, login_required

from .errors import GlobalError, LocalException
Expand Down Expand Up @@ -84,6 +84,11 @@ def __init__(
self.save = save

self.__session = requests.Session()
self.__session.headers.update(BASE_HEADERS)

# Meroshare has bad SSL configuration so we need to disable SSL verification
self.__session.verify = False

self.auth_token = __auth_token

if not self.dpid:
Expand Down
4 changes: 1 addition & 3 deletions nepseutils/core/meroshare.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,12 +274,10 @@ def fetch_capital_list() -> dict:
return capitals

@staticmethod
# @retry(stop=stop_after_attempt(5), wait=wait_fixed(3), reraise=True)
def fetch_result_company_list() -> list:
with requests.Session() as sess:
sess.headers = BASE_HEADERS # type: ignore

requests.packages.urllib3.disable_warnings(requests.packages.urllib3.exceptions.InsecureRequestWarning) # type: ignore
sess.verify = False

response = sess.get(
"https://iporesult.cdsc.com.np/result/companyShares/fileUploaded",
Expand Down
Loading

0 comments on commit 609d18a

Please sign in to comment.