reading image data from input URL
This commit is contained in:
@@ -72,14 +72,17 @@ def compute_part(*args: str, input_data: Optional[bytes] = None,
|
|||||||
if input_data is None or len(input_data) == 0:
|
if input_data is None or len(input_data) == 0:
|
||||||
if len(args) <= 1:
|
if len(args) <= 1:
|
||||||
return None, 'Image: received no input data nor URL'
|
return None, 'Image: received no input data nor URL'
|
||||||
|
elif not utils.validate_url(args[1]):
|
||||||
|
return None, 'Image: invalid URL format'
|
||||||
else:
|
else:
|
||||||
return None, 'Image: URL mode not yet implemented'
|
input_data = utils.read_web(args[1])
|
||||||
|
if input_data is None:
|
||||||
|
return None, 'Image: could not reach URL'
|
||||||
|
img = img_factory.build_image_only(input_data)
|
||||||
|
if img is None:
|
||||||
|
return None, 'Image: invalid image format'
|
||||||
else:
|
else:
|
||||||
img = img_factory.build_image_only(input_data)
|
return img, None
|
||||||
if img is None:
|
|
||||||
return None, 'Image: invalid image format'
|
|
||||||
else:
|
|
||||||
return img, None
|
|
||||||
else:
|
else:
|
||||||
meme = meme_db.get_meme(meme_id)
|
meme = meme_db.get_meme(meme_id)
|
||||||
if meme is None:
|
if meme is None:
|
||||||
|
|||||||
Reference in New Issue
Block a user