简体   繁体   中英

How to randomize IP address with requests module in Python?

Is it possible if we can randomize IP address by using requests module? For instance the access.log in nginx is

110.54.222.139 - - [29/Jun/2018:03:00:27 +0000] "GET / HTTP/1.1" 200 4785 "-" "Mozilla/5.0 (X11; U; Linux x86_64; en-US) AppleWebKit/534.16 (KHTML, like Gecko) Ubuntu/10.10 Chromium/10.0.642.0 Chrome/10.0.642.0 Safari/534.1"

can we randomize an ip address to make:

RANDOM_IP_ADDRESS - - [29/Jun/2018:03:00:27 +0000] "GET / HTTP/1.1" 200 4785 "-" "Mozilla/5.0 (X11; U; Linux x86_64; en-US) AppleWebKit/534.16 (KHTML, like Gecko) Ubuntu/10.10 Chromium/10.0.642.0 Chrome/10.0.642.0 Safari/534.1"

I am not sure if a website will block my server's IP address if I continue to use that IP. I aggregate their feed every now and then.

You can't do that (legally/easily...) without actually being able to send traffic from another source address.

If you really want to avoid getting blocked, look at ways to tunnel your traffic through other places. For example: starting your process on a new hosted instance, using vpns, tor.

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