use the requests proxy module and do not change the ip address after success
< hr >Code:
import requests
from bs4 import BeautifulSoup
url=r"http://ip.chinaz.com/"
proxy={"http": "http://177.130.55.164:20183",
"https": "https://177.130.55.164:20183"}
html=requests.get(url,proxies=proxy,timeout=10)
html=BeautifulSoup(html.text,"lxml")
nr=html.select(".getlist")
print(nr)