Web抓取:请求错误('连接中止'),操作错误(0,'错误'))

2024-06-10 03:48:07 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在尝试使用json链接请求对数据进行webscrape(数量有点大)

    data = []
    for cid in (lookup['CID'].unique()) :
        req_url = "https://pubchem.ncbi.nlm.nih.gov/rest/pug_view/data/compound/{0}/JSON".format(cid)
        response = requests.get(req_url)
        data.append(response.json()) 

我正在通过命令提示符进行本地测试(这是Azure函数的一部分)。因此,在检查代码运行状态时,出现如下错误:

"output":"{"Error": "('Connection aborted.', OSError(0, 'Error'))"}"

在此之前,在安装某些需求时,我在包和依赖项方面遇到了一些错误:

WARNING: pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.

请提出解决办法


Tags: 数据injsonurlfordata数量is