import requests
import pprint


def login_api():
    values = {
        "username": "xxxxx@qq.com",
        "password": "xxxx",
        "url": "",
        "ismobile": "false",
        "rememberMe": "true"
    }
    res = requests.post("https://pre.xxxxx.com.cn/api2/user/login", data=values)
    a = res.cookies["PHPSESSID"]
    # print(a)
    return a


def list_name(sessionid):
    headers = {
        "Cookie": "PHPSESSID=" + sessionid,
    }
    # print(headers)    #{'cookie': 'PHPSESSID=xxxxxxxxxc817e'}
    res = requests.get("https://pre.xxxxx.com.cn/api2/user/contacts/GetUsers?start=0&perPage=100&role_id=1",
                       headers=headers)
    # pprint.pprint(res.json()["result"]["aaData"])
    everypne = res.json()["result"]["aaData&#