【问题标题】:How to make a scrapy request on a url that have more then one parameter?如何在具有多个参数的 url 上发出 scrapy 请求?
【发布时间】:2016-02-24 08:18:57
【问题描述】:

我正在尝试首先使用废壳发出请求,只是为了测试这种 url 的 Xpath:

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

但是请求只去'action=search'...其他参数被请求..

我如何构建这个请求?

【问题讨论】:

  • 你有没有试过在从scrapy shell打开它时使用引号? scrapy shell "site.com/search/?action=search&description=MY SEARCH &e_author="
  • 是的,使用引号应该可以

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


【解决方案1】:

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

我会选择urllib.quote()

> import urllib

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-11-23
    • 2010-12-22
    • 2021-05-04
    • 2016-11-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-04-30
    相关资源
    最近更新 更多