scrapy中的请求如何添加参数

1.直接在网址后拼接

url='https://buff.163.com/api/market/goods/price_history/buff'

data={
    
    
            'game' : 'csgo' ,
            'page_num' : '1' ,
            'use_suggestion' : '0' ,
            '_' : '1681384999985'
    }

urls='https://buff.163.com/api/market/goods/price_history/buff?game=csgo&goods_id=35803&currency=CNY&days=30&buff_price_type=2&_=1681384999985'

2.利用scrapy.FormRequest

urlp='https://buff.163.com/api/market/goods/price_history/buff'
data3={
    
    
                'game': 'csgo',
                'goods_id': str(id),
                'currency': 'CNY',
                'days': '30',
                'buff_price_type': '2',
                '_': tim()
            }
yield scrapy.FormRequest(url='https://buff.163.com/api/market/goods/price_history/buff?',callback=self.prices,formdata=data3,method='GET')            

method=‘GET’ 声明请求方式

猜你喜欢

转载自blog.csdn.net/qq_62975494/article/details/130142527
今日推荐