iata-validator-client 1.0.0__py3-none-any.whl
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.
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"""
|
|
2
|
+
IATA Air Cargo AWB, E-Ticket & Baggage Tag Validator API Python Client SDK (Zero External Dependencies)
|
|
3
|
+
"""
|
|
4
|
+
import os
|
|
5
|
+
import json
|
|
6
|
+
import urllib.request
|
|
7
|
+
import urllib.error
|
|
8
|
+
from typing import Any, Dict, Optional
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class IataValidatorClient:
|
|
12
|
+
"""
|
|
13
|
+
Client for IATA Air Cargo AWB, E-Ticket & Baggage Tag Validator API.
|
|
14
|
+
|
|
15
|
+
:param api_key: RapidAPI key ('x-rapidapi-key'). Optional for test evaluation.
|
|
16
|
+
Get your key at: https://rapidapi.com/noor-mkdad-apis-noor-mkdad-apis-default/api/iata-air-cargo-awb-eticket-validator
|
|
17
|
+
:param base_url: Custom API endpoint override.
|
|
18
|
+
:param rapidapi_host: RapidAPI host header.
|
|
19
|
+
"""
|
|
20
|
+
def __init__(
|
|
21
|
+
self,
|
|
22
|
+
api_key: Optional[str] = None,
|
|
23
|
+
base_url: Optional[str] = None,
|
|
24
|
+
rapidapi_host: str = "iata-air-cargo-awb-eticket-validator.p.rapidapi.com"
|
|
25
|
+
):
|
|
26
|
+
self.api_key = api_key or os.environ.get("RAPIDAPI_KEY", "")
|
|
27
|
+
self.rapidapi_host = rapidapi_host
|
|
28
|
+
if base_url:
|
|
29
|
+
self.base_url = base_url.rstrip("/")
|
|
30
|
+
elif self.api_key:
|
|
31
|
+
self.base_url = "https://iata-air-cargo-awb-eticket-validator.p.rapidapi.com"
|
|
32
|
+
else:
|
|
33
|
+
self.base_url = "https://iata-validator.alph4nir.workers.dev".rstrip("/")
|
|
34
|
+
|
|
35
|
+
def request(self, endpoint: str, method: str = "GET", payload: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
|
|
36
|
+
url = f"{self.base_url}/{endpoint.lstrip('/')}"
|
|
37
|
+
headers = {
|
|
38
|
+
"Content-Type": "application/json",
|
|
39
|
+
"Accept": "application/json",
|
|
40
|
+
"User-Agent": "iata-validator-python-client/1.0"
|
|
41
|
+
}
|
|
42
|
+
if self.api_key:
|
|
43
|
+
headers["x-rapidapi-key"] = self.api_key
|
|
44
|
+
headers["x-rapidapi-host"] = self.rapidapi_host
|
|
45
|
+
|
|
46
|
+
data = json.dumps(payload).encode("utf-8") if payload else None
|
|
47
|
+
req = urllib.request.Request(url, data=data, headers=headers, method=method)
|
|
48
|
+
|
|
49
|
+
try:
|
|
50
|
+
with urllib.request.urlopen(req, timeout=10) as response:
|
|
51
|
+
res_data = json.loads(response.read().decode("utf-8"))
|
|
52
|
+
if not self.api_key and response.status == 200:
|
|
53
|
+
meta = res_data.setdefault("meta", {})
|
|
54
|
+
meta["notice"] = "Free evaluation tier. Subscribe for full throughput & SLA: https://rapidapi.com/noor-mkdad-apis-noor-mkdad-apis-default/api/iata-air-cargo-awb-eticket-validator"
|
|
55
|
+
return res_data
|
|
56
|
+
except urllib.error.HTTPError as e:
|
|
57
|
+
try:
|
|
58
|
+
return json.loads(e.read().decode("utf-8"))
|
|
59
|
+
except Exception:
|
|
60
|
+
return {
|
|
61
|
+
"success": False,
|
|
62
|
+
"error": f"HTTP {e.code}: {e.reason}",
|
|
63
|
+
"code": f"HTTP_{e.code}",
|
|
64
|
+
"upgrade_url": "https://rapidapi.com/noor-mkdad-apis-noor-mkdad-apis-default/api/iata-air-cargo-awb-eticket-validator"
|
|
65
|
+
}
|
|
66
|
+
except Exception as e:
|
|
67
|
+
return {"success": False, "error": str(e), "code": "NETWORK_ERROR"}
|
|
68
|
+
|
|
69
|
+
def get_health(self) -> Dict[str, Any]:
|
|
70
|
+
"""Check edge health status."""
|
|
71
|
+
return self.request("/health", method="GET")
|
|
72
|
+
|
|
73
|
+
def validate(self, payload: Dict[str, Any]) -> Dict[str, Any]:
|
|
74
|
+
"""Submit validation/parse request."""
|
|
75
|
+
return self.request("/api/v1/validate", method="POST", payload=payload)
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: iata-validator-client
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Official zero-dependency Python client for IATA Air Cargo AWB, E-Ticket & Baggage Tag Validator API via RapidAPI
|
|
5
|
+
Author: RapidAPI Microservices Portfolio
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://rapidapi.com/noor-mkdad-apis-noor-mkdad-apis-default/api/iata-air-cargo-awb-eticket-validator
|
|
8
|
+
Project-URL: Documentation, https://rapidapi.com/noor-mkdad-apis-noor-mkdad-apis-default/api/iata-air-cargo-awb-eticket-validator
|
|
9
|
+
Project-URL: Source, https://github.com/DrMkdaddy/api-monorepo
|
|
10
|
+
Keywords: iata-validator,rapidapi,sdk,api,validation,fintech
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Operating System :: OS Independent
|
|
13
|
+
Description-Content-Type: text/markdown
|
|
14
|
+
|
|
15
|
+
# IATA Air Cargo AWB, E-Ticket & Baggage Tag Validator API — Python Client
|
|
16
|
+
|
|
17
|
+
[](https://pypi.org/project/iata-validator-client/)
|
|
18
|
+
[](https://opensource.org/licenses/MIT)
|
|
19
|
+
[](https://rapidapi.com/noor-mkdad-apis-noor-mkdad-apis-default/api/iata-air-cargo-awb-eticket-validator)
|
|
20
|
+
|
|
21
|
+
Official zero-dependency Python client for **IATA Air Cargo AWB, E-Ticket & Baggage Tag Validator API**.
|
|
22
|
+
|
|
23
|
+
> 🔑 **Get your Dedicated API Key:** [Subscribe to IATA Air Cargo AWB, E-Ticket & Baggage Tag Validator API on RapidAPI](https://rapidapi.com/noor-mkdad-apis-noor-mkdad-apis-default/api/iata-air-cargo-awb-eticket-validator)
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## 🚀 Installation
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
pip install iata-validator-client
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## ⚡ Quickstart
|
|
36
|
+
|
|
37
|
+
```python
|
|
38
|
+
from iata_validator_client import IataValidatorClient
|
|
39
|
+
|
|
40
|
+
# Zero config for sandbox testing, or pass your RapidAPI key for production
|
|
41
|
+
client = IataValidatorClient(api_key="YOUR_RAPIDAPI_KEY")
|
|
42
|
+
|
|
43
|
+
result = client.validate({
|
|
44
|
+
# Enter validation payload
|
|
45
|
+
})
|
|
46
|
+
|
|
47
|
+
print(result)
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
## 📚 API Reference
|
|
53
|
+
|
|
54
|
+
### `IataValidatorClient(api_key=..., base_url=...)`
|
|
55
|
+
- `api_key` *(optional)*: RapidAPI Key (`x-rapidapi-key`).
|
|
56
|
+
- `base_url` *(optional)*: Direct edge worker override URL.
|
|
57
|
+
|
|
58
|
+
### `client.validate(payload)`
|
|
59
|
+
Dispatches standard validation / parse request with sub-5ms latency.
|
|
60
|
+
|
|
61
|
+
### `client.get_health()`
|
|
62
|
+
Checks edge isolate health and responsiveness.
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
## 🔗 Links
|
|
67
|
+
- 📖 [RapidAPI Documentation & Key](https://rapidapi.com/noor-mkdad-apis-noor-mkdad-apis-default/api/iata-air-cargo-awb-eticket-validator)
|
|
68
|
+
|
|
69
|
+
## 📄 License
|
|
70
|
+
MIT © RapidAPI Microservices Portfolio
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
iata_validator_client/__init__.py,sha256=ab8cCen8NKDNyddFRxceQMyoGbsVP-vKloUraOUCUlI,3338
|
|
2
|
+
iata_validator_client-1.0.0.dist-info/METADATA,sha256=BLQYC7Ww0wbxOOrQnfBYvsHS-z2j1dBMwEWT1YgDoV8,2578
|
|
3
|
+
iata_validator_client-1.0.0.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
|
|
4
|
+
iata_validator_client-1.0.0.dist-info/top_level.txt,sha256=YM-dDxH-PABfwX6BPHKVozW9TI095VKzGBqFwr81h0I,22
|
|
5
|
+
iata_validator_client-1.0.0.dist-info/RECORD,,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
iata_validator_client
|