creative-x-ferrero/get_dimensions.py
DJP b6af9d79d6 Add comprehensive project status document and dimensions query tool
STATUS.md includes:
- Complete project summary
- What's been built and tested
- Current blocker (staging environment has test brands only)
- Exact next steps when real environment available
- Performance metrics and code quality notes
- Quick resume commands for future work

get_dimensions.py:
- Utility to query /dimensions endpoint
- Shows available brands, markets, channels
- Helps validate environment before uploads

Ready to resume when proper staging/production environment is available.
2026-01-09 14:55:08 -05:00

78 lines
2.3 KiB
Python

#!/usr/bin/env python3
"""
Query CreativeX /dimensions endpoint to see valid values
"""
import sys
import json
from pathlib import Path
sys.path.insert(0, str(Path(__file__).parent))
from config import load_config
from core.api_client import CreativeXAPIClient
def main():
config = load_config()
client = CreativeXAPIClient(
config.api_base_url,
config.access_token,
config.api_max_retries,
config.api_timeout
)
print("Fetching dimensions from CreativeX API...")
print("=" * 60)
try:
response = client._make_request('GET', '/dimensions')
print("\nFull Response:")
print(json.dumps(response, indent=2))
# Print specific sections if available
if isinstance(response, dict):
if 'brands' in response:
print("\n\nAvailable Brands:")
print("=" * 60)
brands = response['brands']
if isinstance(brands, list):
for brand in brands[:10]: # Show first 10
print(f" {brand}")
if len(brands) > 10:
print(f" ... and {len(brands) - 10} more")
else:
print(brands)
if 'channels' in response:
print("\n\nAvailable Channels:")
print("=" * 60)
channels = response['channels']
if isinstance(channels, list):
for channel in channels[:20]: # Show first 20
print(f" {channel}")
if len(channels) > 20:
print(f" ... and {len(channels) - 20} more")
else:
print(channels)
if 'markets' in response:
print("\n\nAvailable Markets:")
print("=" * 60)
markets = response['markets']
if isinstance(markets, list):
for market in markets[:10]: # Show first 10
print(f" {market}")
if len(markets) > 10:
print(f" ... and {len(markets) - 10} more")
else:
print(markets)
except Exception as e:
print(f"Error: {e}")
return 1
return 0
if __name__ == '__main__':
sys.exit(main())