face_logout.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 #coding=utf-8
3 
4 import time,cv2
5 import os
6 import base64
7 import urllib2
8 import sys
9 from json import *
10 
11 result = {0:"成功", 1:"请求超时",2:"识别/核身解析结果错误",3:"识别解析结果错误",4:"识别解析相似度错误",
12  5:"输入信息错误",6:"无该Userid对应信息",7:"获取注册人脸图片数据错误",
13  8:"Base64解码错误",9:"人脸数据提取失败",10:"删除人脸失败",11:"图片过大,不超过初始配置大小(1280,720",
14  12:"文件不存在",13:"人脸图片打开失败",14:"人脸已存在(注册人脸时method=normal情况下,userid重复",
15  15:"未检测到网卡",16:"输入信息不合法",17:"一键开门失败",18:"文件读取失败",2019:"恢复出厂设置失败",
16  2010:"数据清除失败",2021:"获取日志列表失败",22:"MAC地址不匹配"}
17 
18 class face_logout():
19  def __init__(self):
20  try:
21  user_name= sys.argv[1]
22  if user_name =="all":
23  self.logoutall()
24  else:
25  self.logoutuser(user_name)
26 
27  except KeyboardInterrupt:
28  print(" Has Exited or Finished!")
29  except IndexError:
30  print("Please input the correct command and try again!")
31 
32  def logoutall(self):
33  url = "http://192.168.8.141:8000/management/logoutall"
34  req = urllib2.Request(url)
35  response = urllib2.urlopen(req)
36  buf = response.read()
37  body = JSONDecoder().decode(buf)
38  print body
39 
40  def logoutuser(self,user_name):
41  userid = user_name
42  url="http://192.168.8.141:8000/management/logout?userid="+userid
43  req = urllib2.Request(url)
44  response = urllib2.urlopen(req)
45  buf = response.read()
46  body = JSONDecoder().decode(buf)
47  ret = body["Ret"]
48  print("返回状态:"),
49  print body["Ret"],
50  print result[ret]
51 
52 
53 
54 if __name__ == '__main__':
55  face_logout()
56 
57 
58 
59 
60 
def logoutuser(self, user_name)
Definition: face_logout.py:40


xbot_face
Author(s):
autogenerated on Sat Oct 10 2020 03:27:46