Team Ai
Apppublic

operations-granite/HuggingFace-Granite-AI-Practice-Agent-Dev

sourceHugging Faceapache-2.0updated 3mo agoView on Hugging Face
0likes
test_zoho_api_direct.py54 linesDownload Raw Back to root
1#!/usr/bin/env python32"""3Test Zoho API directly to see what data it returns4"""5import sys, os6sys.path.insert(0, 'backend')7 8import asyncio9from backend.services.zoho_crm_service import ZohoCRMService10 11async def main():12    print("๐Ÿ” Testing Zoho CRM API Directly\n")13 14    zoho = ZohoCRMService()15 16    # Test deals17    print("๐Ÿ“Š Fetching Deals...")18    try:19        deals = await zoho.get_deals(limit=500)20        print(f"   Returned: {len(deals)} deals")21        if deals:22            print(f"   Sample: {deals[0].get('Deal_Name', 'N/A')} - ${deals[0].get('Amount', 0)}")23        else:24            print("   โš ๏ธ  No deals returned from Zoho API")25    except Exception as e:26        print(f"   โŒ Error: {e}")27 28    # Test accounts29    print("\n๐Ÿข Fetching Accounts...")30    try:31        accounts = await zoho.get_accounts(limit=50)32        print(f"   Returned: {len(accounts)} accounts")33        if accounts:34            print(f"   Sample: {accounts[0].get('Account_Name', 'N/A')}")35        else:36            print("   โš ๏ธ  No accounts returned from Zoho API")37    except Exception as e:38        print(f"   โŒ Error: {e}")39 40    # Test contacts41    print("\n๐Ÿ‘ฅ Fetching Contacts...")42    try:43        contacts = await zoho.get_contacts(limit=50)44        print(f"   Returned: {len(contacts)} contacts")45        if contacts:46            print(f"   Sample: {contacts[0].get('Full_Name', 'N/A')}")47        else:48            print("   โš ๏ธ  No contacts returned from Zoho API")49    except Exception as e:50        print(f"   โŒ Error: {e}")51 52if __name__ == "__main__":53    asyncio.run(main())54