63 lines
1.4 KiB
Python
63 lines
1.4 KiB
Python
|
|
"""
|
||
|
|
Test upload script for Verofy API
|
||
|
|
Uploads first 10 records of each shapefile layer to test the mapping
|
||
|
|
"""
|
||
|
|
|
||
|
|
import os
|
||
|
|
import sys
|
||
|
|
from pathlib import Path
|
||
|
|
from verofy_uploader import upload_to_verofy
|
||
|
|
|
||
|
|
# Get credentials from environment
|
||
|
|
EMAIL = os.getenv("VEROFY_USER")
|
||
|
|
PASSWORD = os.getenv("VEROFY_PASS")
|
||
|
|
|
||
|
|
if not EMAIL or not PASSWORD:
|
||
|
|
print("❌ Missing environment variables: Please set VEROFY_USER and VEROFY_PASS")
|
||
|
|
sys.exit(1)
|
||
|
|
|
||
|
|
# Configuration
|
||
|
|
MAP_ID = 16950
|
||
|
|
TEMP_DIR = "../temp"
|
||
|
|
LIMIT = 10 # Upload only first 10 records per layer
|
||
|
|
|
||
|
|
print("=" * 60)
|
||
|
|
print("VEROFY API UPLOAD TEST")
|
||
|
|
print("=" * 60)
|
||
|
|
print(f"Map ID: {MAP_ID}")
|
||
|
|
print(f"Temp Directory: {TEMP_DIR}")
|
||
|
|
print(f"Limit per layer: {LIMIT} records")
|
||
|
|
print(f"Email: {EMAIL}")
|
||
|
|
print("=" * 60)
|
||
|
|
print()
|
||
|
|
|
||
|
|
# Run the upload
|
||
|
|
result = upload_to_verofy(
|
||
|
|
temp_dir=TEMP_DIR,
|
||
|
|
map_id=MAP_ID,
|
||
|
|
email=EMAIL,
|
||
|
|
password=PASSWORD,
|
||
|
|
limit=LIMIT
|
||
|
|
)
|
||
|
|
|
||
|
|
# Display results
|
||
|
|
print()
|
||
|
|
print("=" * 60)
|
||
|
|
print("UPLOAD RESULTS")
|
||
|
|
print("=" * 60)
|
||
|
|
print(f"Success: {result['success']}")
|
||
|
|
print()
|
||
|
|
print("Uploaded counts by layer:")
|
||
|
|
for shapefile, count in result.get('uploaded', {}).items():
|
||
|
|
print(f" {shapefile}: {count} records")
|
||
|
|
|
||
|
|
if result.get('errors'):
|
||
|
|
print()
|
||
|
|
print("Errors encountered:")
|
||
|
|
for error in result['errors'][:20]: # Show first 20 errors
|
||
|
|
print(f" - {error}")
|
||
|
|
if len(result['errors']) > 20:
|
||
|
|
print(f" ... and {len(result['errors']) - 20} more errors")
|
||
|
|
|
||
|
|
print("=" * 60)
|