Spaces:
Runtime error
Runtime error
Update app.py
Browse files247 unmodified lines2482492502512522532542552562572582592602612622 unmodified lines26526626726826927027167 unmodified lines339340341342343344247 unmodified linesstatus_placeholder.info(f"📡 **Downloading Master Account List… ({prog} accounts | page {page_count})**")# Pushed count=200 for faster account pullingurl = f"https://api.repsly.com/v3/export/clients/{last_id}?count=200"_, data = _get_with_retry(url, (api_user, api_pass), status_placeholder, f"clients page id={last_id}")if data is None: breakif total_count is None: total_count = _extract_total_count(data)batch = data.get("Clients", [])# THE FIX: Pure array empty check. No arbitrary limits.if not batch: breakfor client in batch:2 unmodified linesif cid: seen_client_ids.add(cid)clients.append(client)new_last_id = extract_pagination_key(data, "lastid")if not new_last_id or new_last_id == last_id:same_cursor_count += 1if same_cursor_count >= MAX_SAME_CURSOR: break67 unmodified linessame_cursor_count = 0last_id = new_idreturn forms_slim# --- THE MASTER TOGGLE ---247 unmodified lines2482492502512522532542552562572582592602 unmodified lines26326426526626726826927027127227327427567 unmodified lines343344345346347348349350247 unmodified linesstatus_placeholder.info(f"📡 **Downloading Master Account List… ({prog} accounts | page {page_count})**")url = f"https://api.repsly.com/v3/export/clients/{last_id}"_, data = _get_with_retry(url, (api_user, api_pass), status_placeholder, f"clients page id={last_id}")if data is None: breakif total_count is None: total_count = _extract_total_count(data)batch = data.get("Clients", [])if not batch: breakfor client in batch:2 unmodified linesif cid: seen_client_ids.add(cid)clients.append(client)# THE CRITICAL FIX: Repsly Clients API uses LastTimeStamp for its bookmark!new_last_id = extract_pagination_key(data, "lasttimestamp")# Fallback to lastid just in caseif not new_last_id:new_last_id = extract_pagination_key(data, "lastid")if not new_last_id or new_last_id == last_id:same_cursor_count += 1if same_cursor_count >= MAX_SAME_CURSOR: break67 unmodified linessame_cursor_count = 0last_id = new_idif len(batch) < REPSLY_PAGE_SIZE: breakreturn forms_slim# --- THE MASTER TOGGLE ---
app.py+10-4