21 lines
584 B
Python
21 lines
584 B
Python
#!/usr/bin/env python3
|
|
"""Test script to verify image download from URL."""
|
|
|
|
import urllib.request
|
|
import sys
|
|
|
|
try:
|
|
url = "https://www.python.org/static/img/python-logo.png"
|
|
print(f"Downloading from {url}...")
|
|
with urllib.request.urlopen(url, timeout=30) as resp:
|
|
data = resp.read()
|
|
print(f"Downloaded {len(data)} bytes")
|
|
|
|
# Save it
|
|
with open("/root/.hermes/wizard-outputs/spark/python_logo.png", "wb") as f:
|
|
f.write(data)
|
|
print("Saved to python_logo.png")
|
|
sys.exit(0)
|
|
except Exception as e:
|
|
print(f"ERROR: {e}")
|
|
sys.exit(1) |