【问题标题】:Receiving an error when trying to run 'scrapy crawl'尝试运行“scrapy crawl”时收到错误
【发布时间】:2017-11-08 23:48:31
【问题描述】:

运行“scrapy crawl word”后,我收到一个错误。我正在尝试使用 Scrapy 来抓取 fda 网站。我正在网上学习教程。这是我的代码:

import scrapy

class WordSpider(scrapy.Spider):
    name = "word"

def start_requests(self):
    start_url = [
        'https://www.fda.gov/Safety/Recalls/'
    ]

def parse(self, response):
    page = response.url
    filename = 'www.fda-%s.html' % page
    with open(filename, 'wb') as f:
        f.write(response.body)

我对代码做了一点改动,因为我只需要一个 url,而“www”对于链接的工作很重要。

我得到的错误是:

:0: UserWarning: You do not have a working installation of the service_identity module: 'No module named cryptography.x509'.

我尝试安装 service_identity 但收到同样的错误。不确定我的代码是不正确还是缺少某些包。

【问题讨论】:

    标签: python python-3.x web-scraping scrapy


    【解决方案1】:

    好像你缺少一些 TLS 包,我建议安装密码学和 OpenSSL 包。

    pip install cryptography
    

    OpenSSL:

    【讨论】:

      猜你喜欢
      • 2012-08-12
      • 1970-01-01
      • 1970-01-01
      • 2013-09-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多