python requests库

python学习网 2017-06-22 23:49:02

#-*-   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) #打印网页返回状态

 

阅读(884) 评论(0)