@@ -51,6 +51,7 @@ def root(
5151 result ['cpu_average_load' ] = os .getloadavg ()
5252 return result
5353
54+
5455# File size validates NGINX
5556@app .post ("/image" , tags = ["image" ])
5657async def upload_image_file (
@@ -63,6 +64,7 @@ async def upload_image_file(
6364 OAuth2AuthorizationCodeBearer = Depends (validate_token )):
6465 return handle_upload_image_file (True if thumbnail == 'True' else False , file )
6566
67+
6668@app .post ("/images" , tags = ["image" ])
6769async def upload_image_files (
6870 thumbnail : Optional [str ] = Query (
@@ -81,6 +83,7 @@ async def upload_image_files(
8183 )
8284 return handle_multiple_image_file_uploads (files , fileAmount , True if thumbnail == 'True' else False )
8385
86+
8487@app .get ("/image" , tags = ["image" ])
8588async def get_image (
8689 image : str = Query (...,
@@ -96,6 +99,7 @@ async def get_image(
9699 ):
97100 return response_image_file (image , image_type )
98101
102+
99103@app .post ("/qrImage" , tags = ["image" ])
100104async def text_to_generate_qr_image (
101105 qr_text : str = Query (
@@ -138,20 +142,6 @@ async def image_from_url(
138142 OAuth2AuthorizationCodeBearer = Depends (validate_token )):
139143 return handle_download_data_from_url (image_url , True if thumbnail == 'True' else False , file_type = 'image' )
140144
141- @app .get ("/videoUrl" , tags = ["from url" ])
142- async def video_from_url (
143- video_url : str = Query (
144- None ,
145- description = "Pass valid video url to upload" ,
146- min_length = 5
147- ),
148- optimize : Optional [str ] = Query (
149- os .environ .get ('VIDEO_OPTIMIZE' ),
150- description = 'True/False depending your needs default is {}' .format (os .environ .get ('VIDEO_OPTIMIZE' )),
151- regex = '^(True|False)$'
152- ),
153- OAuth2AuthorizationCodeBearer = Depends (validate_token )):
154- return handle_download_data_from_url (video_url , True if optimize == 'True' else False , file_type = 'video' )
155145
156146@app .get ("/imageUrls" , tags = ["from url" ])
157147async def images_from_urls (
@@ -167,4 +157,20 @@ async def images_from_urls(
167157 status_code = status .HTTP_413_REQUEST_ENTITY_TOO_LARGE ,
168158 detail = 'Amount of files must not be more than {}' .format (os .environ .get ('MULTIPLE_FILE_UPLOAD_LIMIT' ))
169159 )
170- return handle_multiple_image_file_downloads (image_urls , fileAmount )
160+ return handle_multiple_image_file_downloads (image_urls , fileAmount )
161+
162+
163+ @app .get ("/videoUrl" , tags = ["from url" ])
164+ async def video_from_url (
165+ video_url : str = Query (
166+ None ,
167+ description = "Pass valid video url to upload" ,
168+ min_length = 5
169+ ),
170+ optimize : Optional [str ] = Query (
171+ os .environ .get ('VIDEO_OPTIMIZE' ),
172+ description = 'True/False depending your needs default is {}' .format (os .environ .get ('VIDEO_OPTIMIZE' )),
173+ regex = '^(True|False)$'
174+ ),
175+ OAuth2AuthorizationCodeBearer = Depends (validate_token )):
176+ return handle_download_data_from_url (video_url , False , True if optimize == 'True' else False , file_type = 'video' )
0 commit comments