标签:code pre request sock pytho 模块 port nbsp 代理
#-*- coding:utf-8 -*-
import requests #导入模块
html = requests.get(url).text #get请求
html = requests.post(url,data = postdata).text # post表单请求
设置socket 代理
proxies = { ‘http‘:‘sock5://127.0.0.1:8080‘, ‘http‘:‘sock5://127.0.0.1:7070‘ } # 添加代理ip 作为参数传入
response = requests.get("https://www.taobao.com",proxies=proxies)
print(response.status_code) #打印网页返回状态
标签:code pre request sock pytho 模块 port nbsp 代理
原文地址:http://www.cnblogs.com/bobo1657179419/p/7067133.html