1

我在 csv 文件中有大约 1000 个带有相关 doi 的文章链接,我需要下载这些论文。

我尝试过以下方式:

List_dois = [""] #here I have inserted the list of 1000 doi

out = 'out_folder'
logging.basicConfig(filename='myapp.log', level=logging.INFO)
for doi in List_dois:
    try:
        SciHub(doi, out).download(choose_scihub_url_index=3)
        time.sleep(10)
    except:
        logging.info("Error!", sys.exc_info()[0], doi)

但大约下载 10 次后,它会产生以下错误:

Traceback (most recent call last):
  File "/home/username/PycharmProjects/pythonProject3/main.py", line 65, in <module>
    sci = SciHub(doi, out).download(choose_scihub_url_index=3)
  File "/home/username/PycharmProjects/pythonProject3/venv/lib/python3.8/site-packages/scidownl/scihub.py", line 90, in download
    self.download_pdf(pdf)
  File "/home/username/PycharmProjects/pythonProject3/venv/lib/python3.8/site-packages/scidownl/scihub.py", line 147, in download_pdf
    if self.is_captcha_page(res):
  File "/home/usernamePycharmProjects/pythonProject3/venv/lib/python3.8/site-packages/scidownl/scihub.py", line 184, in is_captcha_page
    return 'must-revalidate' in res.headers['Cache-Control']
  File "/home/username/PycharmProjects/pythonProject3/venv/lib/python3.8/site-packages/requests/structures.py", line 54, in getitem
    return self._store[key.lower()][1]
KeyError: 'cache-control'

我该如何解决这个问题?不想把睡眠时间增加太多,不然手术真的太长了……

4

0 回答 0