顺丰快递单号批量提取

import requests,json
from lxpy import copy_headers_dict
# cookie写自己的就行
for page in range(1,1000):
    url = "https://www.sf-express.com/sf-service-core-web/service/waybills/list/send?lang=sc&region=cn&translate=sc&timestamp=1669796557279&pageNo="+ str(page) +"&pageRows=10"
    headers = '''
    Accept: application/json, text/plain, */*
    Accept-Encoding: gzip, deflate, br
    Accept-Language: zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6
    Connection: keep-alive
    Cookie:
    Host: www.sf-express.com
    Referer: https://www.sf-express.com/we/ow/chn/sc/waybill/list
    User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36 Edg/107.0.1418.56
    '''
    headers = copy_headers_dict(headers)
    res = requests.get(url=url,headers=headers)
    # print(res.text)
    res = json.loads(res.text)

    if len(res['result']['content']) == 0:
        print("ending...")
        break

    for i in range(len(res['result']['content'])):
        orderno = res['result']['content'][i]['waybillno']
        city = res['result']['content'][i]['destinationCityName']
        endTime = res['result']['content'][i]['endTime']
        print(orderno,city,endTime)

评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值