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

View File

@ -1,3 +1,4 @@
# -*-coding:utf-8 -*-
import time import time
import random import random
import base64 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 import os
token = '' token = ''
app_id = '微信配置界面的AppID' app_id = '开发者ID(AppID)'
secret = '配置界面的开发者密码AppSecret' secret = '开发者密码(AppSecret)'
def img_download(url, name): def img_download(url, name):