import requests
import json
import numpy as np
import warnings
warnings.filterwarnings("ignore")
def headers():
header = {
"Content - Type": "application/json;charset = UTF - 8",
"j_token": "1616376601693320233902d07435b9e3a0516df2b3986"
}
return header
def pagemun():
url = "https://xxxxx.com.cn/gateway/mc/api/scrm-admin-api/sms/td/smsTdList"
json_data = {"pageNum": 1, "pageSize": 100}
res = requests.post(url, json=json_data, headers=headers(), verify=False)
# print(res.json()["data"]["pages"])
return res.json()["data"]["pages"]
def phone():
phone_list = []
num = pagemun()
# print(num)
url = "https://xxxxx.com.cn/gateway/mc/api/scrm-admin-api/sms/td/smsTdList"
for i in range(1, num + 1):
json_data = {"pageNum": i, "pageSize": 100}
res = requests.post(url, json=json_data, headers=headers(), verify=False)
for j in range(len(res.json()["data"]["list"])):
phone_list.append(res.json()["data"]["list"][j]["mobile"])
print(len(phone_list))
# print(phone_list)
phones = dict(zip(*np.unique(phone_list, return_counts=True))) # 出现重复的key时,val值加1
print(len(phones))
for key, val in phones.items():
if phones[key] > 1:
print(key, val)
if __name__ == '__main__':
phone()