Oops, guys, today I share with you, how to ip proxy (proxy ip use tutorial) Oh. This is something, as if you have a janitor at the door of your house, if you want to go out to play, you can let him help you block others, so that others can not see your real face.
How to do ip proxy
Well, the first step, let's talk about why we need to use proxy ip. if you often surf the Internet, you will always come across some websites to restrict your access, and some information will be based on your ip address to locate. Sometimes, you may need some special ip address for crawling, data collection and other operations, this time the proxy ip will come in handy.
Proxy ip tutorial
First of all, let's see how to get a proxy ip. to get a proxy ip, you can choose to buy a paid proxy ip or get a free proxy ip through some free proxy ip websites. here I'll share a simple way to get a free proxy ip.
"`ipipgothon
import requests
from bs4 import BeautifulSoup
def get_free_proxy().
url = 'http://www.shenlongip.com'
headers = {'User-Agent': 'Mozilla/5.0'}
r = requests.get(url, headers=headers)
soup = BeautifulSoup(r.text, 'html.parser')
proxy_list = []
for tr in soup.find_all('tr')[1:]::
tds = tr.find_all('td')
ip = tds[1].text
port = tds[2].text
protocol = tds[5].text
proxy_list.append(f'{protocol}://{ip}:{port}')
return proxy_list
“`
The above code is a simple way to get a free proxy ip using Python. Of course, after getting the proxy ip, we need to set it accordingly, so that we can successfully use the proxy ip to access.
Overall, learning how to do ip proxy can help us better protect our privacy, bypass some access restrictions and perform some special operations. I hope that the partners can be used flexibly in the actual application, have fun ~!