mirror of
https://github.com/pacnpal/thrillwiki_django_no_react.git
synced 2026-01-01 23:47:04 -05:00
feat: Implement initial schema and add various API, service, and management command enhancements across the application.
This commit is contained in:
@@ -29,13 +29,7 @@ def step1_get_upload_url():
|
||||
print("Step 1: Requesting upload URL...")
|
||||
|
||||
url = f"{API_BASE}/cloudflare-images/api/upload-url/"
|
||||
data = {
|
||||
"metadata": {
|
||||
"type": "avatar",
|
||||
"userId": "7627" # Replace with your user ID
|
||||
},
|
||||
"require_signed_urls": False
|
||||
}
|
||||
data = {"metadata": {"type": "avatar", "userId": "7627"}, "require_signed_urls": False} # Replace with your user ID
|
||||
|
||||
response = requests.post(url, json=data, headers=HEADERS)
|
||||
print(f"Status: {response.status_code}")
|
||||
@@ -54,11 +48,9 @@ def step2_upload_image(upload_url):
|
||||
|
||||
# Create a simple test image (1x1 pixel PNG)
|
||||
# This is a minimal valid PNG file
|
||||
png_data = b'\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR\x00\x00\x00\x01\x00\x00\x00\x01\x08\x02\x00\x00\x00\x90wS\xde\x00\x00\x00\tpHYs\x00\x00\x0b\x13\x00\x00\x0b\x13\x01\x00\x9a\x9c\x18\x00\x00\x00\x12IDATx\x9cc```bPPP\x00\x02\xd2\x00\x00\x00\x05\x00\x01\r\n-\xdb\x00\x00\x00\x00IEND\xaeB`\x82'
|
||||
png_data = b"\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR\x00\x00\x00\x01\x00\x00\x00\x01\x08\x02\x00\x00\x00\x90wS\xde\x00\x00\x00\tpHYs\x00\x00\x0b\x13\x00\x00\x0b\x13\x01\x00\x9a\x9c\x18\x00\x00\x00\x12IDATx\x9cc```bPPP\x00\x02\xd2\x00\x00\x00\x05\x00\x01\r\n-\xdb\x00\x00\x00\x00IEND\xaeB`\x82"
|
||||
|
||||
files = {
|
||||
'file': ('test_avatar.png', png_data, 'image/png')
|
||||
}
|
||||
files = {"file": ("test_avatar.png", png_data, "image/png")}
|
||||
|
||||
# Upload to Cloudflare (no auth headers needed for direct upload)
|
||||
response = requests.post(upload_url, files=files)
|
||||
@@ -76,9 +68,7 @@ def step3_save_avatar(cloudflare_id):
|
||||
print("\nStep 3: Saving avatar reference...")
|
||||
|
||||
url = f"{API_BASE}/accounts/profile/avatar/save/"
|
||||
data = {
|
||||
"cloudflare_image_id": cloudflare_id
|
||||
}
|
||||
data = {"cloudflare_image_id": cloudflare_id}
|
||||
|
||||
response = requests.post(url, json=data, headers=HEADERS)
|
||||
print(f"Status: {response.status_code}")
|
||||
|
||||
Reference in New Issue
Block a user