Neurolingua
commited on
Commit
•
60076e0
1
Parent(s):
46b984a
Update app.py
Browse files
app.py
CHANGED
@@ -81,7 +81,8 @@ def whatsapp_webhook():
|
|
81 |
content_type = request.values.get('MediaContentType0')
|
82 |
|
83 |
if content_type.startswith('image/'):
|
84 |
-
r = requests.get(media_url
|
|
|
85 |
|
86 |
# Generate a unique filename
|
87 |
filename = f"{uuid.uuid4()}.jpg"
|
@@ -89,7 +90,7 @@ def whatsapp_webhook():
|
|
89 |
|
90 |
if 1==1:
|
91 |
with open(filepath, 'wb') as out_file:
|
92 |
-
|
93 |
|
94 |
# Check file size and existence
|
95 |
if os.path.getsize(filepath) == 0:
|
|
|
81 |
content_type = request.values.get('MediaContentType0')
|
82 |
|
83 |
if content_type.startswith('image/'):
|
84 |
+
r = requests.get(media_url)
|
85 |
+
r.raise_for_status()
|
86 |
|
87 |
# Generate a unique filename
|
88 |
filename = f"{uuid.uuid4()}.jpg"
|
|
|
90 |
|
91 |
if 1==1:
|
92 |
with open(filepath, 'wb') as out_file:
|
93 |
+
out_file.write(r.content)
|
94 |
|
95 |
# Check file size and existence
|
96 |
if os.path.getsize(filepath) == 0:
|