Home > other >  About using a proxy Ip crawl site abroad
About using a proxy Ip crawl site abroad

Time:11-03

The code is as follows, or can only access the domestic website,
 the from bs4 import BeautifulSoup 
The import requests
Import the random
The import time

If __name__=="__main__ ':

Url='https://www.google.com/'
# url='https://www.baidu.com/'
Headers={
"The user-agent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36 "
}
Proxy_ip={' HTTPS: '200.255.122.174:8080}
The response=requests. Get (url=url, headers=headers, proxies=proxy_ip, verify=False)
Print (response. Status_code)
  • Related