ming 3 лет назад
Родитель
Сommit
ef28a0353d
1 измененных файлов с 10 добавлено и 1 удалено
  1. 10 1
      api/main.py

+ 10 - 1
api/main.py

@@ -165,7 +165,15 @@ def get_url_type(url):
     r = urllib.request.urlopen(req)
     contentType = r.getheader('Content-Type')
     return contentType
-
+def notify_group(msg):
+    glist=['WekCRfnAirSiSxALiD6gcm0B56EejsoK89zFbIaiZQD']
+    for gid in glist:
+        headers = {
+                "Authorization": "Bearer " + gid,
+                "Content-Type": "application/x-www-form-urlencoded"
+        }
+        params = {"message": msg}   
+        r = requests.post("https://notify-api.line.me/api/notify",headers=headers, params=params)
 def gen_video(name_hash,name,text_content, image_urls,avatar,client_id):
     c = rpyc.connect("localhost", 8878)
     c._config['sync_request_timeout'] = None
@@ -215,6 +223,7 @@ def gen_avatar(name_hash, imgurl):
             
         except:
             print('gen error')
+            notify_group('無法辨識人臉')
         db['avatar_queue'].delete(id=works[0]['id'])
         statement = 'UPDATE avatar_service_status SET status = 0 WHERE id=1;'  #only one row in this table, which id 1 one
         db.query(statement)