2012-01-17 26 views
3

在Ubuntu上,Scrapy Torproject

[[email protected] tmp]$ sudo /etc/init.d/tor status 
tor is running 
[[email protected] tmp]$ sudo /etc/init.d/polipo start 
Starting polipo: /usr/bin/polipo already running -- doing nothing 
polipo. 

也:

$ python -c 'import urllib; print urllib.getproxies()' 
{'ftp': 'ftp://127.0.0.1:8118/', 'all': 'socks://127.0.0.1:8118/', 
'http': 'http://127.0.0.1:8118/', 'https': 'https://127.0.0.1:8118/', 
'no': 'localhost,127.0.0.0/8,*.local'} 

當運行scrapy我得到:

ERROR: Error downloading https://registration.example.com/login.fcc : [Failure instance: Traceback (failure with no frames): : [('SSL routines', 'SSL23_READ', 'ssl handshake failure')] ]

,而在同一時間FireFox的管理,以正確地獲取頁面 通過代理

任何幫助,將不勝感激, 謝謝, 蓋伊

回答

3

您是否嘗試通過代理鏈運行腳本?要安裝在Ubuntu:

:~$ sudo apt-get install proxychains 

然後配置/etc/proxychains.conf文件,TOR(SOCKS4/5)的工作。

# defaults set to "tor" 

socks4 127.0.0.1 9050

然後,你可以儘管TOR

:~$ proxychains scriptwhatever.py target 

一旦你知道TOR工作正常,我在proxychains.conf文件建議安靜模式下運行任何東西。

# Quiet mode (no output from library).
quiet_mode