How to add parameters to the request in scrapy

1. Splicing directly after the URL

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. Use 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' declares the request method

Guess you like

Origin blog.csdn.net/qq_62975494/article/details/130142527