如何在具有多个参数的url上发出scrapy请求?

时间:2015-11-22 01:04:33

标签: python web-scraping web-crawler scrapy scrapy-spider

我首先尝试使用scrap shell发出请求,只是为了测试Xpath到这种网址:

site.com/search/?action=search&description=MY SEARCH &e_author=

但请求只会转到' action = search' ......已请求其他参数..

如何构建此请求?

1 个答案:

答案 0 :(得分:1)

在发出请求之前,您必须规范化网址,请参阅:

我会选择urllib.quote()

> import urllib

> quoted_url = urllib.quote(url)
> fetch(quoted_url)