Reputation: 1587
If we use requests
and we need Passing Parameters In URLs we can use params
import requests
params = (
('q', 'scrapy'),
)
response = requests.get('https://github.com/search', params=params)
response.url will be
In [4]: response.url
Out[4]: 'https://github.com/search?q=scrapy'
https://2.python-requests.org//en/latest/user/quickstart/#passing-parameters-in-urls
But how Passing Parameters In URLs if we use Scrapy?
Upvotes: 0
Views: 299
Reputation: 1587
Need use FormRequest
with GET method and pass params
in formdata
return FormRequest(url='https://github.com/search',
method='GET',
headers=headers,
formdata=params,
callback=self.parse_data)
Upvotes: 1