【问题标题】:SplashRequest gives - TypeError: attrs() got an unexpected keyword argument 'eq'SplashRequest 给出 - TypeError: attrs() got an unexpected keyword argument 'eq'
【发布时间】:2020-05-20 03:31:10
【问题描述】:

我正在使用来自 ScrapingHub 的云 Splash 实例。我正在尝试使用 Scrapy-Splash 库执行一个简单的请求,但我不断收到错误消息:

@attr.s(hash=False, repr=False, eq=False)
TypeError: attrs() got an unexpected keyword argument 'eq'

任何关于错误出现原因的想法/线索将不胜感激。

我使用的代码如下所示(使用 Python 3.6 和 Scrapy v 2.1.0):

import scrapy
from scrapy_splash import SplashRequest


class MySpider(scrapy.Spider):
    start_urls = ['https://www.sportsgirl.com.au', 'http://maryons.com.au']

    def start_requests(self):
        for url in self.start_urls:
            yield SplashRequest(url, self.parse, args={'wait': 0.5})

    def parse(self, response):    
        print(response)


MySpider().start_requests()

settings.py 的值如下:

DOWNLOADER_MIDDLEWARES = {
    'scrapy_splash.SplashCookiesMiddleware': 723,
    'scrapy_splash.SplashMiddleware': 725,
    'scrapy.downloadermiddlewares.httpcompression.HttpCompressionMiddleware': 810,
}

SPIDER_MIDDLEWARES = {
    'scrapy_splash.SplashDeduplicateArgsMiddleware': 100,
}

SPLASH_URL = 'https://my-splash-url.scrapinghub.com'

【问题讨论】:

  • 可能是一个错误。向存储库提交票证。
  • 谢谢,我会发消息给他们确认。如果是错误,我会开票。

标签: python scrapy-splash


【解决方案1】:

错误来自 Twisted 库,它是 Scrapy 的依赖项。

看起来它已在最新版本中修复。如果你运行

pip install --upgrade twisted

你应该没事的!

【讨论】:

  • 谢谢! Scrappy 需要尽快修复它们的依赖版本
【解决方案2】:

我还必须升级 attrs 以使错误消息消失。

pip3 install attrs==19.2.0 -i http://mirrors.aliyun.com/pypi/simple --trusted-host mirrors.aliyun.com

我发现这个:https://www.programmersought.com/article/61587312947

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-11-16
    • 1970-01-01
    • 2021-01-19
    • 1970-01-01
    • 2022-01-12
    • 2015-09-23
    • 2021-06-03
    • 1970-01-01
    相关资源
    最近更新 更多