Answer the question
In order to leave comments, you need to log in
How to bypass blocking by ip (via requests + tor)?
Good afternoon!
It is necessary to parse some data, the site rests and bans by ip. I found such an article about parsing with the help of Thor.
https://habr.com/ru/company/ods/blog/346632/
But there are non-working moments from paragraphs "2.2 Thor is the son of Odin" and "2.3 The first path" of this article.
def get_html(x):
UserAgent().firefox
socks.set_default_proxy(socks.SOCKS5, "localhost", 9150)
socket.socket = socks.socksocket
ip = requests.get(x, headers={'User-Agent': UserAgent().firefox})
soup = BeautifulSoup(ip, 'html.parser')
temp = soup.find(attrs={'class': 'datatable dt-outline dt-bordered dt-striped'})
print(temp)
def get_html(x):
UserAgent().firefox
# socks.set_default_proxy(socks.SOCKS5, "localhost", 9150)
# socket.socket = socks.socksocket
ip = requests.get(x, headers={'User-Agent': UserAgent().firefox})
soup = BeautifulSoup(ip, 'html.parser')
temp = soup.find(attrs={'class': 'datatable dt-outline dt-bordered dt-striped'})
print(temp)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question