add submit_filing(): 3x web retry then fax fallback, fix success detection, shared attestation helper
This commit is contained in:
parent
4a4bbd048e
commit
b90d443667
2 changed files with 162 additions and 37 deletions
|
|
@ -229,10 +229,19 @@ async def submit_mcs150(
|
|||
confirmation_text = await page.inner_text("body")
|
||||
|
||||
# Check for success indicators
|
||||
success = any(kw in confirmation_text.lower() for kw in [
|
||||
# Note: after successful submission, FMCSA redirects to www.fmcsa.dot.gov
|
||||
# which may return 403 (Akamai WAF). The submission still went through —
|
||||
# FMCSA sends a confirmation email to the address we provided.
|
||||
# So a redirect away from ask.fmcsa.dot.gov IS a success signal.
|
||||
redirected_away = "ask.fmcsa.dot.gov" not in page.url
|
||||
has_confirmation_keywords = any(kw in confirmation_text.lower() for kw in [
|
||||
"thank you", "submitted", "received", "confirmation",
|
||||
"reference number", "ticket", "case"
|
||||
"reference number", "ticket", "case",
|
||||
])
|
||||
has_error_keywords = any(kw in confirmation_text.lower() for kw in [
|
||||
"please select an item", "required field", "invalid",
|
||||
])
|
||||
success = (redirected_away or has_confirmation_keywords) and not has_error_keywords
|
||||
|
||||
LOG.info("[fmcsa] Submission %s for DOT %s",
|
||||
"succeeded" if success else "may have failed", dot_number)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue