Python-如何在网址没有.pdf扩展名的情况下解析在线pdf文件

时间:2018-09-10 08:24:05

标签: python scrapy urllib2 pypdf2

我正在尝试从在线pdf文件中提取数据。我试图将此code实施到此url,但出现urlopen错误。我注意到没有任何.pdf扩展名。有什么建议吗?

错误

hs.logger.defaultLogLevel

代码

Traceback (most recent call last):
  File "C:/Users/Danial/Desktop/pdf.py", line 7, in <module>
    op = urllib2.urlopen(Request(url)).read()
  File "C:\Python27\lib\urllib2.py", line 154, in urlopen
    return opener.open(url, data, timeout)
  File "C:\Python27\lib\urllib2.py", line 431, in open
    response = self._open(req, data)
  File "C:\Python27\lib\urllib2.py", line 449, in _open
    '_open', req)
  File "C:\Python27\lib\urllib2.py", line 409, in _call_chain
    result = func(*args)
  File "C:\Python27\lib\urllib2.py", line 1240, in https_open
    context=self._context)
  File "C:\Python27\lib\urllib2.py", line 1197, in do_open
    raise URLError(err)
URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:581)>

0 个答案:

没有答案