mirror of
https://github.com/pacnpal/thrillwiki_django_no_react.git
synced 2025-12-21 20:31:11 -05:00
Sandbox URL Creation
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
import os
|
||||
import requests
|
||||
from django.core.management.base import BaseCommand
|
||||
from django.core.files import File
|
||||
from django.core.files.temp import NamedTemporaryFile
|
||||
@@ -9,6 +8,7 @@ from rides.models import Ride
|
||||
from django.contrib.contenttypes.models import ContentType
|
||||
import json
|
||||
from django.core.files.base import ContentFile
|
||||
from security import safe_requests
|
||||
|
||||
class Command(BaseCommand):
|
||||
help = 'Download photos from seed data URLs'
|
||||
@@ -33,7 +33,7 @@ class Command(BaseCommand):
|
||||
try:
|
||||
# Download image
|
||||
self.stdout.write(f'Downloading from URL: {photo_url}')
|
||||
response = requests.get(photo_url, timeout=60)
|
||||
response = safe_requests.get(photo_url, timeout=60)
|
||||
if response.status_code == 200:
|
||||
# Delete any existing photos for this park
|
||||
Photo.objects.filter(
|
||||
@@ -74,7 +74,7 @@ class Command(BaseCommand):
|
||||
try:
|
||||
# Download image
|
||||
self.stdout.write(f'Downloading from URL: {photo_url}')
|
||||
response = requests.get(photo_url, timeout=60)
|
||||
response = safe_requests.get(photo_url, timeout=60)
|
||||
if response.status_code == 200:
|
||||
# Delete any existing photos for this ride
|
||||
Photo.objects.filter(
|
||||
|
||||
Reference in New Issue
Block a user