Amazon Business API integration replacing browser automation
- Add amazon_api.py with Reconciliation + Document API client - OAuth flow with manual code exchange for local installations - Dual mode: API (recommended) or Browser automation (fallback) - New settings: amazon_app_id, amazon_client_id, amazon_client_secret, amazon_refresh_token - Platform UI with mode switcher, API credential fields, OAuth button - Scheduler supports both API and browser modes - README with full Amazon API setup guide - httpx added for async HTTP requests Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
+8
-1
@@ -6,6 +6,8 @@ from apscheduler.triggers.interval import IntervalTrigger
|
||||
from app.mail_processor import process_mailbox
|
||||
from app.smb_processor import process_smb_share
|
||||
from app.amazon_processor import process_amazon
|
||||
from app.amazon_api import process_amazon_api
|
||||
from app.database import get_settings
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -34,7 +36,12 @@ async def _run_processor():
|
||||
# Amazon separately with timeout - must not block next scheduler runs
|
||||
logger.info("Starte automatische Amazon-Verarbeitung...")
|
||||
try:
|
||||
amazon_result = await asyncio.wait_for(process_amazon(), timeout=300)
|
||||
settings = await get_settings()
|
||||
amazon_mode = settings.get("amazon_mode", "browser")
|
||||
if amazon_mode == "api":
|
||||
amazon_result = await asyncio.wait_for(process_amazon_api(), timeout=300)
|
||||
else:
|
||||
amazon_result = await asyncio.wait_for(process_amazon(), timeout=300)
|
||||
logger.info(f"Amazon-Verarbeitung abgeschlossen: {amazon_result}")
|
||||
except asyncio.TimeoutError:
|
||||
logger.error("Amazon-Verarbeitung nach 5 Minuten abgebrochen (Timeout)")
|
||||
|
||||
Reference in New Issue
Block a user