简体   繁体   中英

Access denied to a website using tor

I am trying to make a bot that requests a url through tor. I have configured tor. Below is the python code.

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 | url used cloudflare to restrict access.

But when the same url is accessed through browser with tor configured, the url is successfully accessed.

Is there a way out to access the URL using the python script?

Thanks

更改pycurl的user_agent,如:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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