#!/usr/bin/env python3
"""Test Google Ads API connection and list accessible accounts."""

import sys
sys.path.insert(0, '/Users/dominiquezhoumacmini/Library/Python/3.9/lib/python/site-packages')

from google.ads.googleads.client import GoogleAdsClient

def main():
    client = GoogleAdsClient.load_from_storage("/Users/dominiquezhoumacmini/.google-ads.yaml")
    
    # List accessible customers
    customer_service = client.get_service("CustomerService")
    
    try:
        accessible_customers = customer_service.list_accessible_customers()
        print("Accessible accounts:")
        for resource_name in accessible_customers.resource_names:
            customer_id = resource_name.split('/')[-1]
            print(f"  - {customer_id}")
    except Exception as e:
        print(f"Error listing customers: {e}")

if __name__ == "__main__":
    main()
