Sign in before filtering the order export

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-11-21 14:22:30 +03:30
parent 389b39105e
commit 8f6e617972
2 changed files with 30 additions and 0 deletions

View File

@@ -331,6 +331,9 @@ def _load_order_export(client, day: date, prefixes: list[str]) -> tuple[str, str
"""Prefer the filtered export. A failed post still returns the full CSV."""
if getattr(client, "session", None) is None:
return client.fetch_customer_orders()
# The report GET redirects to login until the client has signed in.
if hasattr(client, "login") and not getattr(client, "_logged_in", False):
client.login()
try:
return export_filtered_customer_orders(client, day, prefixes)
except (_FilterMiss, OSError):