qums-fetch 0.4.4.dev1__tar.gz → 0.4.4.dev2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: qums-fetch
3
- Version: 0.4.4.dev1
3
+ Version: 0.4.4.dev2
4
4
  Summary: Login and fetch data from QUMS-ERP Dashboard
5
5
  Author: Ishaan Gupta
6
6
  Author-email: Ishaan Gupta <ishaan.ishu@proton.me>
@@ -4,7 +4,7 @@ build-backend = "uv_build"
4
4
 
5
5
  [project]
6
6
  name = "qums-fetch"
7
- version = "0.4.4.dev1"
7
+ version = "0.4.4.dev2"
8
8
  description = "Login and fetch data from QUMS-ERP Dashboard"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.14"
@@ -4,7 +4,7 @@ build-backend = "uv_build"
4
4
 
5
5
  [project]
6
6
  name = "qums-fetch"
7
- version = "0.4.4.dev1"
7
+ version = "0.4.4.dev2"
8
8
  description = "Login and fetch data from QUMS-ERP Dashboard"
9
9
  readme = "README.md"
10
10
  authors = [
@@ -245,7 +245,7 @@ class Client:
245
245
 
246
246
  # Check if login was successful
247
247
  def _looks_like_login_success(self, resp: requests.Response) -> bool:
248
- if resp.url == BASE_URL:
248
+ if resp.url.rstrip("/") == BASE_URL:
249
249
  soup = BeautifulSoup(resp.text, "html.parser")
250
250
  still_has_captcha = soup.select_one(CAPTCHA_IMG_SELECTOR) is not None
251
251
  return not still_has_captcha
@@ -255,17 +255,13 @@ class Client:
255
255
  # Extract error message from the login page
256
256
  @staticmethod
257
257
  def _extract_error_message(soup: BeautifulSoup) -> str | None:
258
- captcha_error = soup.select_one(".field-validation-error")
259
- if captcha_error:
260
- text = captcha_error.get_text(strip=True)
261
- if text:
262
- raise CaptchaError(text)
263
-
264
- credentials_error = soup.select_one(".validation-summary-errors")
265
- if credentials_error:
266
- text = credentials_error.get_text(strip=True)
267
- if text:
268
- raise CredentialsError(text)
258
+ error_div = soup.select_one(".validation-summary-errors")
259
+ if error_div:
260
+ error_text = error_div.select_one("li").get_text(strip=True)
261
+ if "password" and "incorrect" in error_text:
262
+ raise CredentialsError(error_text)
263
+ else:
264
+ raise CaptchaError(error_text)
269
265
 
270
266
  return None
271
267