构建request访问公开的api接口

# encoding:utf-8
import requests

import pandas as pd
import urllib3
urllib3.disable_warnings()


Lists_tot = []
T = ""
for i in range(0, 1):
    header = {'Authorization': '在这里添加授权访问的信息'}
    data = {
    "username":"用户名",
    "desc":"部门",
    "plugins":{
    "basic-auth":{
        "disable":False,
        "password":"授权账号昵称",
        "username":"授权账号密码"
        }
    },
    "pageSize": 100,
    "page": 1,
    "bigCid": 6
    }
    #构建
    r = requests.post('接口API链接',
                          json=data,headers=header,verify=False)
    print(r.text)

 

posted @ 2022-10-11 14:24  土星狗蛋  阅读(91)  评论(0)    收藏  举报