2020-01-21 06:35:58 +00:00
|
|
|
from django.core.management.base import BaseCommand, CommandError
|
|
|
|
|
|
|
|
from judge.utils.camo import client as camo_client
|
|
|
|
|
|
|
|
|
|
|
|
class Command(BaseCommand):
|
2022-05-14 17:57:27 +00:00
|
|
|
help = "obtains the camo url for the specified url"
|
2020-01-21 06:35:58 +00:00
|
|
|
|
|
|
|
def add_arguments(self, parser):
|
2022-05-14 17:57:27 +00:00
|
|
|
parser.add_argument("url", help="url to use camo on")
|
2020-01-21 06:35:58 +00:00
|
|
|
|
|
|
|
def handle(self, *args, **options):
|
|
|
|
if camo_client is None:
|
2022-05-14 17:57:27 +00:00
|
|
|
raise CommandError("Camo not available")
|
2020-01-21 06:35:58 +00:00
|
|
|
|
2022-05-14 17:57:27 +00:00
|
|
|
print(camo_client.image_url(options["url"]))
|