-
Notifications
You must be signed in to change notification settings - Fork 0
/
chuimei.py
75 lines (68 loc) · 2.41 KB
/
chuimei.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
import hashlib
import requests
import json
from datetime import datetime
import time
import random
# todo 线索内容 修改此处(销售需要与下面的门店对应)
upload_data = [
# {
# 'customerName': '李四',
# 'customerPhone': str(str(random.randint(130, 139)) + str(random.randint(10000000, 99999999))),
# 'intentCarModel': None,
# 'registerDateTime': datetime.now().strftime('%Y-%m-%d %H:%M:%S'),
# 'extData': {},
# 'spiderCrawlLogId': 1,
# 'salesName': '段三懿',
# 'sourceCategory': 'DCC-400==>400-易车'
# },
# {
# 'customerName': '李四',
# 'customerPhone': str(str(random.randint(130, 139)) + str(random.randint(10000000, 99999999))),
# 'intentCarModel': None,
# 'registerDateTime': datetime.now().strftime('%Y-%m-%d %H:%M:%S'),
# 'extData': {},
# 'spiderCrawlLogId': 1,
# 'salesName': None,
# 'sourceCategory': 'DCC-400==>400-易车'
# }
{
"customerName": "客户",
"customerPhone": "15366965183",
"intentCarModel": "空",
"registerDateTime": "2019-11-13 12:23:33",
"extData": {},
"spiderCrawlLogId": 128744,
"salesName": "王健",
"sourceCategory": "DCC-400==>400-汽车之家"
},
{
"customerName": "客户",
"customerPhone": "15366965183",
"intentCarModel": "空",
"registerDateTime": "2019-11-13 12:20:44",
"extData": {},
"spiderCrawlLogId": 128744,
"salesName": "王健",
"sourceCategory": "DCC-400==>400-汽车之家"
}
]
# todo 来源/门店(需要与上面的销售对应)
upload_body = dict()
upload_body['data'] = json.dumps(upload_data, ensure_ascii=False)
upload_body['orgId'] = 56965
upload_body['followDate'] = '2019-11-05 10:06:00'
upload_body['followBy'] = 'CcUser'
# 排序
upload_body_keys = upload_body.keys()
upload_body_keys = sorted(upload_body_keys)
# 拼接加密参数
encrypt_params = ''
for key in upload_body_keys:
encrypt_params += str(upload_body[key])
# 参数加密
upload_body['signatureKey'] = hashlib.sha256(
(encrypt_params + 'YXdkaXVhd2ZoaTI4OTc0MjYzOHJzZCYjMzk7W3ANCl0=').encode('utf-8')).hexdigest()
print('请求内容:%s' % upload_body)
response = requests.post('http://localhost:8081/business/client/presaleData/pyUpload', data=upload_body)
print('响应内容:%s' % response.text)