python-airselangor 0.1.0__tar.gz → 0.1.1__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.
- {python_airselangor-0.1.0 → python_airselangor-0.1.1}/PKG-INFO +1 -1
- {python_airselangor-0.1.0 → python_airselangor-0.1.1}/pyproject.toml +1 -1
- {python_airselangor-0.1.0 → python_airselangor-0.1.1}/src/airselangor/__init__.py +1 -1
- {python_airselangor-0.1.0 → python_airselangor-0.1.1}/src/airselangor/client.py +2 -10
- {python_airselangor-0.1.0 → python_airselangor-0.1.1}/src/airselangor/exceptions.py +1 -1
- {python_airselangor-0.1.0 → python_airselangor-0.1.1}/src/python_airselangor.egg-info/PKG-INFO +1 -1
- {python_airselangor-0.1.0 → python_airselangor-0.1.1}/README.md +0 -0
- {python_airselangor-0.1.0 → python_airselangor-0.1.1}/setup.cfg +0 -0
- {python_airselangor-0.1.0 → python_airselangor-0.1.1}/src/airselangor/__main__.py +0 -0
- {python_airselangor-0.1.0 → python_airselangor-0.1.1}/src/airselangor/cli.py +0 -0
- {python_airselangor-0.1.0 → python_airselangor-0.1.1}/src/airselangor/models.py +0 -0
- {python_airselangor-0.1.0 → python_airselangor-0.1.1}/src/airselangor/retry.py +0 -0
- {python_airselangor-0.1.0 → python_airselangor-0.1.1}/src/python_airselangor.egg-info/SOURCES.txt +0 -0
- {python_airselangor-0.1.0 → python_airselangor-0.1.1}/src/python_airselangor.egg-info/dependency_links.txt +0 -0
- {python_airselangor-0.1.0 → python_airselangor-0.1.1}/src/python_airselangor.egg-info/entry_points.txt +0 -0
- {python_airselangor-0.1.0 → python_airselangor-0.1.1}/src/python_airselangor.egg-info/requires.txt +0 -0
- {python_airselangor-0.1.0 → python_airselangor-0.1.1}/src/python_airselangor.egg-info/top_level.txt +0 -0
- {python_airselangor-0.1.0 → python_airselangor-0.1.1}/tests/test_client.py +0 -0
|
@@ -1,12 +1,4 @@
|
|
|
1
|
-
"""Async client for the Air Selangor customer API
|
|
2
|
-
|
|
3
|
-
Reverse-engineered from the www.airselangor.com Next.js portal:
|
|
4
|
-
* Every request is a JSON POST to ``https://api3.airselangor.com/<path>``.
|
|
5
|
-
* Unauthenticated calls carry a "public token":
|
|
6
|
-
``Authorization: Bearer sha256("airselangorsecretkey" + Timestamp)``.
|
|
7
|
-
* Authenticated calls carry ``Authorization: Bearer <accesstoken>``.
|
|
8
|
-
* Responses are wrapped: ``{"status": bool, "message": str, "error": {...}, "data": {...}}``.
|
|
9
|
-
"""
|
|
1
|
+
"""Async client for the Air Selangor customer portal API."""
|
|
10
2
|
|
|
11
3
|
from __future__ import annotations
|
|
12
4
|
|
|
@@ -154,7 +146,7 @@ class AirSelangorClient:
|
|
|
154
146
|
raw_text = await resp.text()
|
|
155
147
|
if "Access denied" in raw_text or "Cloudflare" in raw_text or "WAF" in raw_text:
|
|
156
148
|
raise GeoBlockedError()
|
|
157
|
-
raise
|
|
149
|
+
raise AirSelangorApiError(f"{path}: HTTP 403 Forbidden")
|
|
158
150
|
|
|
159
151
|
if status == 429:
|
|
160
152
|
raise AirSelangorRateLimitError(f"{path}: HTTP 429 Too Many Requests")
|
|
@@ -37,7 +37,7 @@ class AirSelangorRateLimitError(AirSelangorError):
|
|
|
37
37
|
"""Raised when API returns rate limit or too many requests (429)."""
|
|
38
38
|
|
|
39
39
|
|
|
40
|
-
class GeoBlockedError(
|
|
40
|
+
class GeoBlockedError(AirSelangorError):
|
|
41
41
|
"""Raised when request is blocked due to geographic/VPN restrictions.
|
|
42
42
|
|
|
43
43
|
Malaysian utility APIs frequently block non-Malaysian IP addresses and VPNs.
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{python_airselangor-0.1.0 → python_airselangor-0.1.1}/src/python_airselangor.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{python_airselangor-0.1.0 → python_airselangor-0.1.1}/src/python_airselangor.egg-info/requires.txt
RENAMED
|
File without changes
|
{python_airselangor-0.1.0 → python_airselangor-0.1.1}/src/python_airselangor.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|