niwayandm commited on
Commit ·
6c5bf90
1
Parent(s): fa25068
Refactor timestamp handle in HubSpot scripts to improve error messaging on n8n
Browse files- python/hubspot_audit.py +4 -2
- python/hubspot_billing.py +5 -3
- python/hubspot_contacts.py +5 -2
- python/hubspot_deals.py +5 -2
- python/hubspot_emails.py +4 -2
- python/hubspot_lineitems.py +5 -2
- python/hubspot_tickets.py +4 -2
python/hubspot_audit.py
CHANGED
|
@@ -243,10 +243,12 @@ if __name__ == "__main__":
|
|
| 243 |
import sys
|
| 244 |
if len(sys.argv) > 1:
|
| 245 |
try:
|
| 246 |
-
|
| 247 |
except Exception as e:
|
| 248 |
print(
|
| 249 |
-
f"Invalid timestamp. Provide epoch ms, ISO-8601, or YYYY-MM-DD. Error: {e}"
|
|
|
|
| 250 |
sys.exit(1)
|
|
|
|
| 251 |
else:
|
| 252 |
main()
|
|
|
|
| 243 |
import sys
|
| 244 |
if len(sys.argv) > 1:
|
| 245 |
try:
|
| 246 |
+
since = _parse_cli_arg_to_ms(sys.argv[1])
|
| 247 |
except Exception as e:
|
| 248 |
print(
|
| 249 |
+
f"Invalid timestamp. Provide epoch ms, ISO-8601, or YYYY-MM-DD. Error: {e}"
|
| 250 |
+
)
|
| 251 |
sys.exit(1)
|
| 252 |
+
main(since_ms=since)
|
| 253 |
else:
|
| 254 |
main()
|
python/hubspot_billing.py
CHANGED
|
@@ -445,10 +445,12 @@ if __name__ == "__main__":
|
|
| 445 |
import sys
|
| 446 |
if len(sys.argv) > 1:
|
| 447 |
try:
|
| 448 |
-
|
| 449 |
except Exception as e:
|
| 450 |
print(
|
| 451 |
-
f"Invalid timestamp. Provide epoch ms, ISO-8601, or YYYY-MM-DD. Error: {e}"
|
| 452 |
-
|
|
|
|
|
|
|
| 453 |
else:
|
| 454 |
main()
|
|
|
|
| 445 |
import sys
|
| 446 |
if len(sys.argv) > 1:
|
| 447 |
try:
|
| 448 |
+
since = _parse_cli_arg_to_ms(sys.argv[1])
|
| 449 |
except Exception as e:
|
| 450 |
print(
|
| 451 |
+
f"Invalid timestamp. Provide epoch ms, ISO-8601, or YYYY-MM-DD. Error: {e}"
|
| 452 |
+
)
|
| 453 |
+
sys.exit(1)
|
| 454 |
+
main(since_ms=since)
|
| 455 |
else:
|
| 456 |
main()
|
python/hubspot_contacts.py
CHANGED
|
@@ -430,9 +430,12 @@ if __name__ == "__main__":
|
|
| 430 |
import sys
|
| 431 |
if len(sys.argv) > 1:
|
| 432 |
try:
|
| 433 |
-
|
| 434 |
except Exception as e:
|
| 435 |
-
print(
|
|
|
|
|
|
|
| 436 |
sys.exit(1)
|
|
|
|
| 437 |
else:
|
| 438 |
main()
|
|
|
|
| 430 |
import sys
|
| 431 |
if len(sys.argv) > 1:
|
| 432 |
try:
|
| 433 |
+
since = _parse_cli_arg_to_ms(sys.argv[1])
|
| 434 |
except Exception as e:
|
| 435 |
+
print(
|
| 436 |
+
f"Invalid timestamp. Provide epoch ms, ISO-8601, or YYYY-MM-DD. Error: {e}"
|
| 437 |
+
)
|
| 438 |
sys.exit(1)
|
| 439 |
+
main(since_ms=since)
|
| 440 |
else:
|
| 441 |
main()
|
python/hubspot_deals.py
CHANGED
|
@@ -443,9 +443,12 @@ if __name__ == "__main__":
|
|
| 443 |
import sys
|
| 444 |
if len(sys.argv) > 1:
|
| 445 |
try:
|
| 446 |
-
|
| 447 |
except Exception as e:
|
| 448 |
-
print(
|
|
|
|
|
|
|
| 449 |
sys.exit(1)
|
|
|
|
| 450 |
else:
|
| 451 |
main()
|
|
|
|
| 443 |
import sys
|
| 444 |
if len(sys.argv) > 1:
|
| 445 |
try:
|
| 446 |
+
since = _parse_cli_arg_to_ms(sys.argv[1])
|
| 447 |
except Exception as e:
|
| 448 |
+
print(
|
| 449 |
+
f"Invalid timestamp. Provide epoch ms, ISO-8601, or YYYY-MM-DD. Error: {e}"
|
| 450 |
+
)
|
| 451 |
sys.exit(1)
|
| 452 |
+
main(since_ms=since)
|
| 453 |
else:
|
| 454 |
main()
|
python/hubspot_emails.py
CHANGED
|
@@ -484,10 +484,12 @@ if __name__ == "__main__":
|
|
| 484 |
import sys
|
| 485 |
if len(sys.argv) > 1:
|
| 486 |
try:
|
| 487 |
-
|
| 488 |
except Exception as e:
|
| 489 |
print(
|
| 490 |
-
f"Invalid timestamp. Provide epoch ms, ISO-8601, or YYYY-MM-DD. Error: {e}"
|
|
|
|
| 491 |
sys.exit(1)
|
|
|
|
| 492 |
else:
|
| 493 |
main()
|
|
|
|
| 484 |
import sys
|
| 485 |
if len(sys.argv) > 1:
|
| 486 |
try:
|
| 487 |
+
since = _parse_cli_arg_to_ms(sys.argv[1])
|
| 488 |
except Exception as e:
|
| 489 |
print(
|
| 490 |
+
f"Invalid timestamp. Provide epoch ms, ISO-8601, or YYYY-MM-DD. Error: {e}"
|
| 491 |
+
)
|
| 492 |
sys.exit(1)
|
| 493 |
+
main(since_ms=since)
|
| 494 |
else:
|
| 495 |
main()
|
python/hubspot_lineitems.py
CHANGED
|
@@ -386,9 +386,12 @@ if __name__ == "__main__":
|
|
| 386 |
import sys
|
| 387 |
if len(sys.argv) > 1:
|
| 388 |
try:
|
| 389 |
-
|
| 390 |
except Exception as e:
|
| 391 |
-
print(
|
|
|
|
|
|
|
| 392 |
sys.exit(1)
|
|
|
|
| 393 |
else:
|
| 394 |
main()
|
|
|
|
| 386 |
import sys
|
| 387 |
if len(sys.argv) > 1:
|
| 388 |
try:
|
| 389 |
+
since = _parse_cli_arg_to_ms(sys.argv[1])
|
| 390 |
except Exception as e:
|
| 391 |
+
print(
|
| 392 |
+
f"Invalid timestamp. Provide epoch ms, ISO-8601, or YYYY-MM-DD. Error: {e}"
|
| 393 |
+
)
|
| 394 |
sys.exit(1)
|
| 395 |
+
main(since_ms=since)
|
| 396 |
else:
|
| 397 |
main()
|
python/hubspot_tickets.py
CHANGED
|
@@ -486,10 +486,12 @@ if __name__ == "__main__":
|
|
| 486 |
import sys
|
| 487 |
if len(sys.argv) > 1:
|
| 488 |
try:
|
| 489 |
-
|
| 490 |
except Exception as e:
|
| 491 |
print(
|
| 492 |
-
f"Invalid timestamp. Provide epoch ms, ISO-8601, or YYYY-MM-DD. Error: {e}"
|
|
|
|
| 493 |
sys.exit(1)
|
|
|
|
| 494 |
else:
|
| 495 |
main()
|
|
|
|
| 486 |
import sys
|
| 487 |
if len(sys.argv) > 1:
|
| 488 |
try:
|
| 489 |
+
since = _parse_cli_arg_to_ms(sys.argv[1])
|
| 490 |
except Exception as e:
|
| 491 |
print(
|
| 492 |
+
f"Invalid timestamp. Provide epoch ms, ISO-8601, or YYYY-MM-DD. Error: {e}"
|
| 493 |
+
)
|
| 494 |
sys.exit(1)
|
| 495 |
+
main(since_ms=since)
|
| 496 |
else:
|
| 497 |
main()
|