ImportError:没有名为教程.设置

2024-03-28 15:08:57 发布

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

我用“scrapy”来刮作者和引用引号.to.scrape.com”,我正在通过一个精英轮流代理池传递刮取请求。 当在没有代理的情况下完成刮取时,结果是成功的。使用代理时,会显示错误-“ImportError:No module named”教程.设置". 你知道吗

我使用'call'函数在代理代码中触发scraper

我是一个初级python程序员。提前谢谢!你知道吗

以下是我的代码:

proxies = ['hardcoded proxies']  
proxy_pool = cycle(proxies) 
url = 'httpbin.org/ip'; 

for i in range(1,12): #Get a proxy from the pool
    proxy = next(proxy_pool) 
    print("Request #%d"%i) 
try: 
    response = requests.get(url,
    proxies={"http": proxy, "https": proxy}) 
    print(response.json()) 
    print("ping/handshake passed through proxy") 
    call(["scrapy","crawl","extract_text_author","extract.jl"])
    #terminal equivalent command of triggering scrapy crawler

    print("scrapy passed through proxy") 

except: 
    print("Skipping. Connnection error") 

Tags: 代码url代理responseextract作者call引号