爬虫练习,化妆品生产许可信息管理系统服务平台信息

#url = 'http://125.35.6.84:81/xk/'
#Request URL: http://125.35.6.84:81/xk/itownet/portalAction.do?method=getXkzsById
#id: ff83aff95c5541cdab5ca6e847514f88
#



import requests

url = 'http://125.35.6.84:81/xk/itownet/portalAction.do?method=getXkzsList'

headers = {
    'User-Agent': "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.163 Safari/537.36"
}
for page in range(1, 6):
    data = {
        'on': 'true',
        'page': str(page),
        'pageSize': '15',
        'productName': '',
        'conditionType': '1',
        'applyname': '',
        'applysn': '',
    }
    repones = requests.post(url=url, headers=headers, data=data)
    repones.encoding = repones.apparent_encoding
    name_text = repones.json()

    for list in name_text['list']:

        ID = list["ID"]
        data2 = {
            'id': str(ID)
        }
        url2 = "http://125.35.6.84:81/xk/itownet/portalAction.do?method=getXkzsById"
        repones2 = requests.post(url=url2, headers=headers, data=data2)
        repones2.encoding = repones2.apparent_encoding
        repones2_text = repones2.json()
        epsName = repones2_text["epsName"]    #公司名称
        epsProductAddress = repones2_text["epsProductAddress"]    #地址
        businessLicenseNumber = repones2_text["businessLicenseNumber"]   #社会信用码
        productSn = repones2_text["productSn"]    #公司许可证

        print("公司名称: " + epsName + "    公司地址: " + epsProductAddress + "    公司社会信用码: " + businessLicenseNumber + "    公司许可证:" + productSn)





你可能感兴趣的:(笔记)