self.common = common
self.url = url
self.path = path
-
- # Use tor socks5 proxy, if enabled
- if self.common.settings['download_over_tor']:
- socks5_address = 'socks5h://{}'.format(self.common.settings['tor_socks_address'])
- self.proxies = {
- 'https': socks5_address,
- 'http': socks5_address
- }
- else:
- self.proxies = None
-
def run(self):
with open(self.path, "wb") as f:
try:
self.url,
headers={"User-Agent": "torbrowser-launcher"},
stream=True,
- proxies=self.proxies,
+ proxies=self.common.proxies(),
)
# If status code isn't 200, something went wrong