1、client

1) httpie

http -f POST example.org hello=World

http POST
http://192.168.200.251:55101/Api/Client/Login? Account=zdd_1
Password=0192023a7bbd73250516f069df18b500 DeviceCode=20190806 > file

login.json

{
  "Account": "zdd_1",
  "Password": "0192023a7bbd73250516f069df18b500",
  "DeviceCode": "20190806"
}

http POST http://192.168.200.251:55101/Api/Client/Login?/login.json @$(pwd)/login.json

2) python requests

import requests
import json
import datetime
import time
from hashlib import md5 #global var
url_base = 'http://192.168.200.251:55101'
account = "zdd_1"
passwd = "admin123"
device_code = "20190806" #timeStamp
get_now_milli_time = lambda: int(time.time() * 1000) #md5
def encrypt_md5(s):
new_md5=md5()
new_md5.update(s.encode(encoding='utf-8'))
return new_md5.hexdigest() ######################################################## # login
url = url_base + '/Api/Client/Login?'
login = {
"Account": "",
"Password": "",
"DeviceCode": ""
} login['Account'] = account
login['Password'] = encrypt_md5(passwd)
login['DeviceCode'] = device_code r = requests.post(url, data = login)
print(r.status_code)
print(r.text)
d = json.loads(r.text)
print(d['Code'])
token = d['Result']['Token']
ID = d['Result']['Id']
print(token)
print(ID) ######################################################## # get reg info
url = url_base + '/Api/Client/GetDeviceRegister?'
get_reg_info = {
"code": "20190806",
"ssoToken": "",
"stationId": "",
"timeStamp": "",
"accessSignature": ""
} get_reg_info['ssoToken'] = token
get_reg_info['timeStamp'] = str(get_now_milli_time())
get_reg_info['stationId'] = ""
get_reg_info['code'] = device_code
s1 = encrypt_md5(get_reg_info['timeStamp']).upper()
print(s1)
s2 = encrypt_md5(ID + s1).upper()
print(s2)
get_reg_info['accessSignature'] = s2
r = requests.get(url,params=get_reg_info)
print(r.status_code)
print(r.text)
d = json.loads(r.text)
print(d)

最新文章

  1. Sqlserver查询结果,让某列结果合并一列并且逗号分隔。
  2. Collection与Map
  3. Laravel Container分析
  4. 最后关于Pipeline完整的图如下:
  5. opencv hog+svm行人检测
  6. ios开发中的toll-free bridged
  7. ASP.NET是如何在IIS下工作的[转]
  8. struts2+Hibernate4+spring3+EasyUI环境搭建之五:引入jquery easyui
  9. libConfuse的使用
  10. ZOJ1221 && UVA567:Risk(Floyd)
  11. FileFilter过滤器
  12. [ZJOI2011]礼物
  13. 拉普拉斯平滑处理 Laplace Smoothing
  14. Math对象的常用属性和方法
  15. c语言的基础知识
  16. 磁盘 -> 硬盘 -> c盘 && 内存
  17. python判断变量是否为int、字符串、列表、元组、字典等方法
  18. 【拓扑排序或差分约束】Guess UVALive - 4255
  19. Redmine 邮件配置
  20. ListBox和ComboBox绑定数据简单例子

热门文章

  1. HDFS学习笔记一
  2. 错误提示:Wrong Local header signature: 0xE011CFD0
  3. css行高的用法总结
  4. Redis 设置权限密码,以及如何开启关闭设置
  5. go语言从例子开始之Example16.函数递归
  6. Tornado框架的简单使用
  7. C++ 浅析调试,内存重叠查看
  8. tp框架基础控制器调用方法
  9. 2019 TCO Round 1B——[ 状压DP ]
  10. uploadify的使用错误