lastwarning 1.0.1__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 @@
1
+ __version__ = "1.0.1"
lastwarning/cli.py ADDED
@@ -0,0 +1,59 @@
1
+ import argparse, json, sys
2
+ from pathlib import Path
3
+ import requests
4
+
5
+ BASE_URL = "https://last-warning.serv00.net/"
6
+ CONFIG_FILE = Path(__file__).with_name("config.json")
7
+
8
+ def load_api_key():
9
+ try:
10
+ with CONFIG_FILE.open("r", encoding="utf-8") as f:
11
+ key = json.load(f).get("api_key", "").strip()
12
+ if not key or key == "PUT_YOUR_API_KEY_HERE":
13
+ raise ValueError("API key is not configured in config.json")
14
+ return key
15
+ except (OSError, json.JSONDecodeError, ValueError) as exc:
16
+ print(f"Configuration error: {exc}")
17
+ return None
18
+
19
+ def lookup_number(number):
20
+ key = load_api_key()
21
+ if not key:
22
+ return None
23
+ try:
24
+ r = requests.get(BASE_URL, params={"type": "num_info_2", "q": number, "api_key": key}, timeout=15)
25
+ r.raise_for_status()
26
+ return r.json()
27
+ except requests.exceptions.RequestException as exc:
28
+ print(f"Request failed: {exc}")
29
+ except ValueError:
30
+ print("API returned invalid JSON.")
31
+ return None
32
+
33
+ def main():
34
+ parser = argparse.ArgumentParser(prog="lb", description="Authorized phone-number lookup")
35
+ parser.add_argument("number")
36
+ args = parser.parse_args()
37
+ data = lookup_number(args.number)
38
+ if not data:
39
+ sys.exit(1)
40
+ if not data.get("success"):
41
+ print("API returned an error:")
42
+ print(data)
43
+ sys.exit(1)
44
+ print(f"Query : {data.get('query')}")
45
+ print(f"Count : {data.get('count')}")
46
+ print(f"Requests : {data.get('req_left')} / {data.get('req_total')}")
47
+ print(f"Expiry : {data.get('expiry')}")
48
+ print(f"Developer: {data.get('developer')}")
49
+ print("-" * 50)
50
+ for i, result in enumerate(data.get("results", []), 1):
51
+ print(f"Result #{i}")
52
+ if "phoneNumber" in result:
53
+ print(f" Phone: {result.get('phoneNumber')}")
54
+ if "name" in result:
55
+ print(f" Name : {result.get('name')}")
56
+ print()
57
+
58
+ if __name__ == "__main__":
59
+ main()
@@ -0,0 +1,3 @@
1
+ {
2
+ "api_key": "hardhackar_accd8a7bee3345d0"
3
+ }
@@ -0,0 +1,6 @@
1
+ Metadata-Version: 2.4
2
+ Name: lastwarning
3
+ Version: 1.0.1
4
+ Summary: Authorized phone-number lookup CLI
5
+ Requires-Python: >=3.9
6
+ Requires-Dist: requests
@@ -0,0 +1,8 @@
1
+ lastwarning/__init__.py,sha256=d4QHYmS_30j0hPN8NmNPnQ_Z0TphDRbu4MtQj9cT9e8,22
2
+ lastwarning/cli.py,sha256=Gfxoy_1MUO0RiryITBb6aojl-sPlriASXy3X4e_MVJk,1986
3
+ lastwarning/config.json,sha256=b3qZ28iuV8xgffpHPK4ugIPBlpINkd6pSjFS3A9sheQ,47
4
+ lastwarning-1.0.1.dist-info/METADATA,sha256=jgpMU3g--9T03WgrXHins0QNZlB3Oq2J9whU3wVZlLs,146
5
+ lastwarning-1.0.1.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
6
+ lastwarning-1.0.1.dist-info/entry_points.txt,sha256=4-9RLw5v3rZlrB6jnNa5BCa-0aMZrtqqAVwOlyWE-XM,44
7
+ lastwarning-1.0.1.dist-info/top_level.txt,sha256=CSLC7EUhh3qSUeABQlasQGkw2mga6cVNOwGMOzv8fb0,12
8
+ lastwarning-1.0.1.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (84.0.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ lb = lastwarning.cli:main
@@ -0,0 +1 @@
1
+ lastwarning