forked from MarseyWorld/MarseyWorld
fds
parent
4d5a821005
commit
cb9087a0d9
|
@ -311,7 +311,8 @@ def submit_contact(v):
|
|||
elif file.content_type.startswith('video/'):
|
||||
file.save("video.mp4")
|
||||
with open("video.mp4", 'rb') as f:
|
||||
req = requests.request("POST", "https://api.imgur.com/3/upload", headers={'Authorization': f'Client-ID {IMGUR_KEY}'}, files=[('video', f)], timeout=5).json()['data']
|
||||
try: req = requests.request("POST", "https://api.imgur.com/3/upload", headers={'Authorization': f'Client-ID {IMGUR_KEY}'}, files=[('video', f)], timeout=5).json()['data']
|
||||
except requests.Timeout: return {"error": "Video upload timed out, please try again!"}
|
||||
try: url = req['link']
|
||||
except: return {"error": req['error']}, 400
|
||||
if url.endswith('.'): url += 'mp4'
|
||||
|
|
Loading…
Reference in New Issue