Created
March 14, 2020 03:22
-
-
Save tyjeon24/6344254c299d313d7431eed617b41c97 to your computer and use it in GitHub Desktop.
Python:Selenium with Tor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Before running the code | |
# 1. Tor service should one service or tor.exe is running. | |
from selenium import webdriver | |
PROXY = "socks5://localhost:9050" | |
options = webdriver.ChromeOptions() | |
options.add_argument('--proxy-server=%s' % PROXY) | |
driver = webdriver.Chrome(options=options, executable_path=r'chromedriver.exe') | |
driver.get("http://check.torproject.org") | |
html = driver.page_source | |
print(html) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment