feat: add recommendation command and expand test coverage
This commit is contained in:
1 parent
702280a416
commit
f9267352cc
9 files changed
+684
-4
No files matched your search
@@ -69,7 +69,9 @@ def read_state(path: str) -> Dict[str, Any]:
|
||||
|
||||
|
||||
def write_state(path: str, state: Dict[str, Any]) -> None:
|
||||
os.makedirs(os.path.dirname(path), exist_ok=True)
|
||||
dirname = os.path.dirname(path)
|
||||
if dirname:
|
||||
os.makedirs(dirname, exist_ok=True)
|
||||
with open(path, "w", encoding="utf-8") as f:
|
||||
json.dump(state, f, ensure_ascii=False, indent=2)
|
||||
|
||||
@@ -103,12 +105,17 @@ def normalize_status(provider: str, status_raw: Any, payload: Any = None) -> str
|
||||
if provider in {"smsvn", "grizzly"}:
|
||||
if s.startswith("STATUS_WAIT_CODE") or s in {"WAIT_CODE", "WAITING"}:
|
||||
return "waiting"
|
||||
if s.startswith("STATUS_OK") or "CODE" in s:
|
||||
if s.startswith("STATUS_OK:") or s == "STATUS_OK":
|
||||
return "code_received"
|
||||
if "CANCEL" in s:
|
||||
return "canceled"
|
||||
if "ACCESS_ACTIVATION" in s or "FINISH" in s:
|
||||
return "completed"
|
||||
if "TIMEOUT" in s or "EXPIRED" in s:
|
||||
return "timeout"
|
||||
if "BANNED" in s:
|
||||
return "banned"
|
||||
return "error"
|
||||
if provider == "5sim":
|
||||
m = {
|
||||
"PENDING": "waiting",
|
||||
|
||||
Reference in new issue
Block a user