pull/8/merge
injetlee 2018-06-16 19:38:50 +08:00
parent 4b8ade301e
commit 9baa9de520
5 changed files with 7 additions and 5 deletions

View File

@ -1,3 +1,4 @@
# -*-coding:utf-8 -*-
import falcon
from falcon import uri
from wechatpy.utils import check_signature
@ -34,11 +35,11 @@ class Connect(object):
resp.body = (xml)
resp.status = falcon.HTTP_200
elif msg.type == 'image':
name = img_download(msg.image, msg.source) # 下载图片
name = img_download(msg.image, msg.source)
print(name)
r = access_api('images/' + name)
if r == '检测成功':
media_id = img_upload('image', 'faces/' + name) # 上传图片,得到 media_id
if r == 'success':
media_id = img_upload('image', 'faces/' + name)
reply = ImageReply(media_id=media_id, message=msg)
else:
reply = TextReply(content='人脸检测失败请上传1M以下人脸清晰的照片', message=msg)

View File

@ -1,3 +1,4 @@
# -*-coding:utf-8 -*-
import time
import random
import base64

Binary file not shown.

After

Width:  |  Height:  |  Size: 183 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 99 KiB

View File

@ -5,8 +5,8 @@ import time
import os
token = ''
app_id = '微信配置界面的AppID'
secret = '配置界面的开发者密码AppSecret'
app_id = '开发者ID(AppID)'
secret = '开发者密码(AppSecret)'
def img_download(url, name):