实例小点
kv = {‘user-agent’:‘Mozilla/5.0’} 代表通用浏览器
kv = {'wd':'Python'} 代表搜索内容-----params=kv
https://www.baidu.com/s?wd + 关键字// 百度关键词接口
爬取图片
import requests
import os
url='xxxxxxxxxxxxxxxxxx'
root = "D://pics//"
path = root +url.split('/')[-1]
try:
if not os.path.exists(path):
os.mkdir(root)
if not os.path.exists(url)
r = requests.get(url)
with open(path,'wb') as f:
f.write(r.content)
f.close()
print("文件保存成功")
else:
print("文件已存在")
except:
print("爬取失败")
r=request.get(url)
r.status_code
with.open(path,'wb ')
***********************
尝试寻找网页的搜索等接口 转化成python可用的api
新手尝试