随笔分类 -  requests

关于session
摘要:s = request.session() print(s.cookies) # 登录 r1 = s.post(url_1=...) print(s.cookies) 可以直接放完下一个接口 r2 = s.post(url_2=...) print(s.cookies) #若要跳过登录,直接往s里面 阅读全文
posted @ 2020-02-18 17:16 大侠修仙 阅读(72) 评论(0) 推荐(0)
关于cookies
摘要:若cookie存在于url上 cc= "cookie=aaaaaaaaaaaaaaaaaa" 先转换为字典格式: c = {} a = cc.split("=") c[a[0]] = a[1] 此时: c = { "cookie":"aaaaaaaaaaaaaaaaaa" } r=requests. 阅读全文
posted @ 2020-01-20 18:54 大侠修仙 阅读(73) 评论(0) 推荐(0)
正则提取
摘要:import re r = requests.post(url) res = r.content.decode("utf_8") result = re.findall("a(.+?)c",res) 有括号或者逗号,要加转义\ 返回的是个list print(result[0]) 阅读全文
posted @ 2020-01-20 17:42 大侠修仙 阅读(109) 评论(0) 推荐(0)
requests之post
摘要:import requests import urllib3 urllib3.disable_warnings() 忽略警告 url = "url" h = { "content-Type":"application/json" "token":"token" } par={ "a":"a" } b 阅读全文
posted @ 2020-01-20 16:17 大侠修仙 阅读(131) 评论(0) 推荐(0)
request请求之get
摘要:import requests import urllib3 urllib3.disable_warnings() 忽略警告 url = "url" h = { "Cookie" : "cookie" } r = request.get(url,headers=h,verify=False) 不去校 阅读全文
posted @ 2020-01-20 15:31 大侠修仙 阅读(360) 评论(0) 推荐(0)
安装request
摘要:环境安装:1、确保pip正常cmd命令 pip 返回正常 2、安装requestspip install requests确认安装成功 pip list,若成功,则展示出requests 3、卸载requests:pip uninstall requests 阅读全文
posted @ 2020-01-20 11:58 大侠修仙 阅读(1304) 评论(0) 推荐(0)