简体   繁体   English

使用 tor 拒绝访问网站

[英]Access denied to a website using tor

I am trying to make a bot that requests a url through tor.我正在尝试制作一个通过 tor 请求 url 的机器人。 I have configured tor.我已经配置了tor。 Below is the python code.下面是python代码。

import pycurl
curl = pycurl.Curl()
curl.setopt(pycurl.URL, URL)
curl.setopt(pycurl.PROXY, '127.0.0.1')
curl.setopt(pycurl.PROXYPORT, 9050)
curl.setopt(pycurl.PROXYTYPE, pycurl.PROXYTYPE_SOCKS5_HOSTNAME)
curl.perform()

It gives html file with, access denied |它给出了 html 文件,访问被拒绝 | url used cloudflare to restrict access. url 使用 cloudflare 来限制访问。

But when the same url is accessed through browser with tor configured, the url is successfully accessed.但是当通过配置了tor的浏览器访问相同的url时,该url访问成功。

Is there a way out to access the URL using the python script?有没有办法使用python脚本访问URL?

Thanks谢谢

更改pycurl的user_agent,如:

curl.setopt(pycurl.USERAGENT, 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:8.0) Gecko/20100101 Firefox/8.0')

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM