当前位置:   article > 正文

python爬取微信小程序,如何爬取小程序数据_微信小程序爬虫

微信小程序爬虫

这篇文章主要介绍了python爬取微信小程序,具有一定借鉴价值,需要的朋友可以参考下。希望大家阅读完这篇文章后大有收获,下面让小编带着大家一起了解一下。

python爬虫——实战篇
2021.7.20晚已更新
注:注释和说明已在代码中注释

笔趣阁小说及其网址爬取

爬取结果:
txt文件,内容是 “小说名:网址”。
在这里插入图片描述
步骤:(几乎所有步骤都一样)
1.右键,查看,network(网络),找到headers:User-agent伪装头
2.点击这个红色同步点击框(最上面那个),然后点击一个小说标题元素
3.查看标签目录
4.编写爬虫程序

  1. import requests
  2. from lxml import etree

url = “https://www.xbiquge.la/”
headers = { ‘User-agent’:‘Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36 Edg/91.0.864.67’}

def main():
html_text = requests.get(url = url, headers = headers).text
#解析

  1. <span class="token comment">#先实例化一个etree对象</span>
  2. html_etree_object <span class="token operator">=</span> etree<span class="token punctuation">.</span>HTML<span class="token punctuation">(</span>html_text<span class="token punctuation">)</span>
  3. passage_title_list1 <span class="token operator">=</span> html_etree_object<span class="token punctuation">.</span>xpath<span class="token punctuation">(</span><span class="token string">"//div/dl/dt/a[@href]"</span><span class="token punctuation">)</span>
  4. passage_addre_list1 <span class="token operator">=</span> html_etree_object<span class="token punctuation">.</span>xpath<span class="token punctuation">(</span><span class="token string">"//dt/a/@href"</span><span class="token punctuation">)</span>
  5. fp <span class="token operator">=</span> <span class="token builtin">open</span><span class="token punctuation">(</span><span class="token string">'data.txt'</span><span class="token punctuation">,</span><span class="token string">'w'</span><span class="token punctuation">,</span>encoding<span class="token operator">=</span><span class="token string">'utf-8'</span><span class="token punctuation">)</span>
  6. <span class="token comment"># print(passage_title_list1)</span>
  7. <span class="token comment"># print(passage_addre_list1)</span>
  8. <span class="token comment"># print(passage_title_list1[0].xpath('./text()'))</span>

#局部解析并写入文件
for (ti,ad) in zip(passage_title_list1,passage_addre_list1):
#print(ti.xpath(“./text()”),ad) ti.xpath(“./text()”)是局部解析,注意需要是./text(),特别注意点号“ . ”不能少!!
fp.write(ti.xpath(“./text()”)[0] + “:” + ad + ‘\n’)
fp.close()

main()

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29

结果:
在这里插入图片描述

4k图片网站图片爬取

爬取结果:
图片存入文件夹
4k图片网站:4K壁纸_4K手机壁纸_4K高清壁纸大全_电脑壁纸_4K,5K,6K,7K,8K壁纸图片素材_彼岸图网

  1. import requests
  2. from lxml import etree
  3. import os

def get_picture():
try:
url = “https://pic.netbian.com/4kdongman/index_2.html”
headers = { ‘User-agent’:‘Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.106 Safari/537.36’}
#抓取网页
html_pic = requests.get(url = url , headers = headers)
#查看状态码,若不是200返回异常
html_pic.raise_for_status()
#编码utf-8
html_pic.encoding = html_pic.apparent_encoding
#使用xpath数据解析
html_text = html_pic.text
etree_html = etree.HTML(html_text)
li_list = etree_html.xpath(‘//div[@class=“slist”]/ul/li’)
#创建文件夹
if not os.path.exists(‘./pictures1’):
os.mkdir(‘./pictures1’)
#写入文件picture1
for li in li_list:
#局部解析出图片地址和名字
pic_add =“https://pic.netbian.com/” + li.xpath(“./a/img/@src”)[0]#注意xpath返回一个列表所以取下标[0],而且返回的地址不完全,所以在网址上打开看一下,把少的域名补上
pic_name = li.xpath(“./a/img/@alt”)[0] + ‘.jpg’
img_data = requests.get(url = pic_add,headers = headers).content
img_path = “pictures1/” + pic_name
with open(img_path,‘ab’) as fp:
fp.write(img_data)
print(pic_name,“保存成功!”)
fp.close()
except:
return“产生异常”
def main():
get_picture()

main()

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39

结果展示:
在这里插入图片描述
在这里插入图片描述

简历模板爬取

爬取结果:
简历模板的压缩包保存到文件夹中
简历模板网站:免费简历模板 个人简历模板 简历模板免费下载-站长素材。
代码如下:(注释已注明)

  1. import requests
  2. from lxml import etree
  3. import os

def main():
url = “https://sc.chinaz.com/jianli/free.html”
headers = { ‘User-agent’: ‘Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.106 Safari/537.36’}
down_data(url, headers)
url_set = set()
#把每一页的url放到一个容器里(有待完善,不能爬取足够多的网址,比如789页)
url_set = get_url(url,headers,url_set)
for urll in url_set:
down_data(urll,headers)

def get_url(url,headers,url_set):#此函数有待完善,缺点是只能爬取第一页的几个分页链接
#其实这个也应该使用try-except
html_text = requests.get(url = url ,headers = headers ).text
html_tree = etree.HTML(html_text)
lable_list = html_tree.xpath(‘//div[@class=“pagination fr clearfix clear”]/a’)
for lable_ in lable_list[2:7]:
lable_url = “https://sc.chinaz.com/jianli/” + lable_.xpath(“./@href”)[0]
url_set.add(lable_url)
return url_set

def down_data(url,headers):
try:
html_ = requests.get(url = url,headers = headers)
#print(“状态码”,html_.status_code)
html_.raise_for_status()
html_.encoding = html_.apparent_encoding
#页面解析
html_text = html_.text
html_tree = etree.HTML(html_text)

  1. <span class="token comment">#局部解析</span>
  2. <span class="token comment">#下载地址列表</span>
  3. loadadd_lable_list <span class="token operator">=</span> html_tree<span class="token punctuation">.</span>xpath<span class="token punctuation">(</span><span class="token string">'//div[@id="container"]/div/a'</span><span class="token punctuation">)</span>
  4. loadadd_list <span class="token operator">=</span> <span class="token punctuation">[</span><span class="token punctuation">]</span>
  5. <span class="token keyword">for</span> lable <span class="token keyword">in</span> loadadd_lable_list<span class="token punctuation">:</span>
  6. loadadd_list<span class="token punctuation">.</span>append<span class="token punctuation">(</span>lable<span class="token punctuation">.</span>xpath<span class="token punctuation">(</span><span class="token string">'./@href'</span><span class="token punctuation">)</span><span class="token punctuation">)</span>
  7. <span class="token comment">#再解析+下载</span>
  8. <span class="token keyword">if</span> <span class="token keyword">not</span> os<span class="token punctuation">.</span>path<span class="token punctuation">.</span>exists<span class="token punctuation">(</span><span class="token string">'./jianli'</span><span class="token punctuation">)</span><span class="token punctuation">:</span>
  9. os<span class="token punctuation">.</span>mkdir<span class="token punctuation">(</span><span class="token string">'./jianli'</span><span class="token punctuation">)</span>
  10. <span class="token keyword">for</span> loadadd <span class="token keyword">in</span> loadadd_list <span class="token punctuation">:</span>
  11. url <span class="token operator">=</span> <span class="token string">"https:"</span> <span class="token operator">+</span> loadadd<span class="token punctuation">[</span><span class="token number">0</span><span class="token punctuation">]</span>
  12. <span class="token comment">#解析单个简历的页面</span>
  13. html_2 <span class="token operator">=</span> requests<span class="token punctuation">.</span>get<span class="token punctuation">(</span>url <span class="token operator">=</span> url<span class="token punctuation">,</span>headers <span class="token operator">=</span> headers<span class="token punctuation">)</span>
  14. html_2<span class="token punctuation">.</span>encoding <span class="token operator">=</span> html_2<span class="token punctuation">.</span>apparent_encoding
  15. etree_html <span class="token operator">=</span> etree<span class="token punctuation">.</span>HTML<span class="token punctuation">(</span>html_2<span class="token punctuation">.</span>text<span class="token punctuation">)</span>
  16. loadfilename <span class="token operator">=</span> etree_html<span class="token punctuation">.</span>xpath<span class="token punctuation">(</span><span class="token string">"//div[@class='ppt_tit clearfix']/h1/text()"</span><span class="token punctuation">)</span>
  17. loadpath <span class="token operator">=</span> <span class="token string">"jianli/"</span> <span class="token operator">+</span> loadfilename<span class="token punctuation">[</span><span class="token number">0</span><span class="token punctuation">]</span> <span class="token operator">+</span> <span class="token string">".rar"</span>
  18. data_address <span class="token operator">=</span> etree_html<span class="token punctuation">.</span>xpath<span class="token punctuation">(</span><span class="token string">'//div[@class="down_wrap"]//li[1]/a/@href'</span><span class="token punctuation">)</span><span class="token punctuation">[</span><span class="token number">0</span><span class="token punctuation">]</span>
  19. jianli_data <span class="token operator">=</span> requests<span class="token punctuation">.</span>get<span class="token punctuation">(</span>url <span class="token operator">=</span> data_address<span class="token punctuation">,</span>headers <span class="token operator">=</span> headers<span class="token punctuation">)</span><span class="token punctuation">.</span>content
  20. <span class="token keyword">with</span> <span class="token builtin">open</span><span class="token punctuation">(</span>loadpath<span class="token punctuation">,</span><span class="token string">"ab"</span><span class="token punctuation">)</span> <span class="token keyword">as</span> fp<span class="token punctuation">:</span>
  21. fp<span class="token punctuation">.</span>write<span class="token punctuation">(</span>jianli_data<span class="token punctuation">)</span>
  22. <span class="token keyword">print</span><span class="token punctuation">(</span>loadfilename<span class="token punctuation">[</span><span class="token number">0</span><span class="token punctuation">]</span><span class="token punctuation">,</span><span class="token string">"保存成功!"</span><span class="token punctuation">)</span>
  23. fp<span class="token punctuation">.</span>close<span class="token punctuation">(</span><span class="token punctuation">)</span>
  24. <span class="token keyword">except</span><span class="token punctuation">:</span>
  25. <span class="token keyword">print</span><span class="token punctuation">(</span><span class="token string">"产生异常"</span><span class="token punctuation">)</span>

main()

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65

结果展示:
在这里插入图片描述

自动填体温小程序

大家可以仿照这个案例去写一个类似的程序(仅供学习使用!!)


我想能不能使用爬虫实现自动补填体温(仅供学习!!!)
在这里插入图片描述
在这里插入图片描述
填完之后点击保存用python画笑脸代码。这个是基本需求。


进入正题:
在这里插入图片描述
在这个界面打开抓包工具(右键检查),切到network,点击登录(提交请求),在network给的一系列包中国找到状态为post的,最下面会有data,这个就是我们需要调用request库post的data,包括账号,密码,验证码,然后就会实现登录,注意需要使用session(会自动保存cookie,这样下次再request 去post体温情况的时候才能是你登录的账号的操作,否则就仍是登录页面),然后提交体温的时候也是类似的操作,点击提交体温按钮发起请求,再network中寻找状态为post的包,看看data的格式,然后使用刚才已经自动保存了cookie的session对象post体温(data)
还有就是,对于验证码我使用的是超级鹰打码平台。

上代码:(由于有的部分涉及到了隐私,所以此代码不可以直接运行!仅供学习参考!!)

  1. import requests
  2. from lxml import etree
  3. from chaojiying.chaojiying import Chaojiying_Client

class tmp_input():

  1. <span class="token keyword">def</span> <span class="token function">__init__</span><span class="token punctuation">(</span>self<span class="token punctuation">,</span>username<span class="token punctuation">,</span>userpaw<span class="token punctuation">)</span><span class="token punctuation">:</span>
  2. self<span class="token punctuation">.</span>username <span class="token operator">=</span> username
  3. self<span class="token punctuation">.</span>userpaw <span class="token operator">=</span> userpaw
  4. <span class="token keyword">def</span> <span class="token function">tmp_in</span><span class="token punctuation">(</span>self<span class="token punctuation">)</span><span class="token punctuation">:</span>
  5. <span class="token comment">#获取验证码图片</span>
  6. url <span class="token operator">=</span> <span class="token string">"登录网址"</span>
  7. headers <span class="token operator">=</span> <span class="token punctuation">{<!-- --></span>
  8. <span class="token string">'User-agent'</span><span class="token punctuation">:</span><span class="token string">'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.106 Safari/537.36'</span><span class="token punctuation">,</span>
  9. <span class="token string">'Referer'</span><span class="token punctuation">:</span><span class="token string">'登录网址'</span><span class="token punctuation">,</span>
  10. <span class="token string">'Cookie'</span><span class="token punctuation">:</span><span class="token string">''</span>
  11. <span class="token punctuation">}</span>
  12. response <span class="token operator">=</span> requests<span class="token punctuation">.</span>get<span class="token punctuation">(</span>url <span class="token operator">=</span> url<span class="token punctuation">,</span>headers <span class="token operator">=</span> headers<span class="token punctuation">)</span>
  13. <span class="token comment">#print(response.status_code)</span>
  14. tree <span class="token operator">=</span> etree<span class="token punctuation">.</span>HTML<span class="token punctuation">(</span>response<span class="token punctuation">.</span>text<span class="token punctuation">)</span>
  15. yzm_pic_address <span class="token operator">=</span> tree<span class="token punctuation">.</span>xpath<span class="token punctuation">(</span><span class="token string">'验证码图片url的xpath表达式'</span><span class="token punctuation">)</span><span class="token punctuation">[</span><span class="token number">0</span><span class="token punctuation">]</span>
  16. <span class="token comment">#print(yzm_pic_address)</span>
  17. yzm_pic <span class="token operator">=</span> requests<span class="token punctuation">.</span>get<span class="token punctuation">(</span>url <span class="token operator">=</span> yzm_pic_address<span class="token punctuation">,</span>headers <span class="token operator">=</span> headers<span class="token punctuation">)</span><span class="token punctuation">.</span>content
  18. <span class="token keyword">with</span> <span class="token builtin">open</span><span class="token punctuation">(</span><span class="token string">"./yzm_pic.jpg"</span><span class="token punctuation">,</span><span class="token string">'wb'</span><span class="token punctuation">)</span> <span class="token keyword">as</span> fp<span class="token punctuation">:</span>
  19. fp<span class="token punctuation">.</span>write<span class="token punctuation">(</span>yzm_pic<span class="token punctuation">)</span>
  20. fp<span class="token punctuation">.</span>close<span class="token punctuation">(</span><span class="token punctuation">)</span>
  21. <span class="token comment">#识别验证码</span>
  22. chaojiying_idf <span class="token operator">=</span> Chaojiying_Client<span class="token punctuation">(</span><span class="token string">''</span><span class="token punctuation">,</span> <span class="token string">''</span><span class="token punctuation">,</span> <span class="token string">''</span><span class="token punctuation">)</span> <span class="token comment"># 这一行调用超级鹰,有三个参数,大家可以去了解一下超级鹰的使用</span>
  23. image <span class="token operator">=</span> <span class="token builtin">open</span><span class="token punctuation">(</span><span class="token string">'yzm_pic.jpg'</span><span class="token punctuation">,</span> <span class="token string">'rb'</span><span class="token punctuation">)</span><span class="token punctuation">.</span>read<span class="token punctuation">(</span><span class="token punctuation">)</span>
  24. yzm <span class="token operator">=</span> chaojiying_idf<span class="token punctuation">.</span>PostPic<span class="token punctuation">(</span>image<span class="token punctuation">,</span> <span class="token number">1005</span><span class="token punctuation">)</span><span class="token punctuation">[</span><span class="token string">'pic_str'</span><span class="token punctuation">]</span> <span class="token comment"># 返回验证码识别后的内容</span>
  25. <span class="token keyword">print</span><span class="token punctuation">(</span><span class="token string">'验证码识别结果:'</span><span class="token punctuation">,</span>yzm<span class="token punctuation">)</span>
  26. <span class="token comment">#登录请求</span>
  27. session <span class="token operator">=</span> requests<span class="token punctuation">.</span>Session<span class="token punctuation">(</span><span class="token punctuation">)</span>
  28. login_url <span class="token operator">=</span> <span class="token string">'登录网址'</span>
  29. csrf <span class="token operator">=</span> tree<span class="token punctuation">.</span>xpath<span class="token punctuation">(</span><span class="token string">'csrf的xpath表达式'</span><span class="token punctuation">)</span><span class="token punctuation">[</span><span class="token number">0</span><span class="token punctuation">]</span>
  30. data <span class="token operator">=</span> <span class="token punctuation">{<!-- --></span>
  31. <span class="token string">'csrfmiddlewaretoken'</span><span class="token punctuation">:</span> csrf<span class="token punctuation">,</span>
  32. <span class="token string">'username'</span><span class="token punctuation">:</span> self<span class="token punctuation">.</span>username<span class="token punctuation">,</span>
  33. <span class="token string">'password'</span><span class="token punctuation">:</span> self<span class="token punctuation">.</span>userpaw<span class="token punctuation">,</span>
  34. <span class="token string">'check_code'</span><span class="token punctuation">:</span> <span class="token builtin">str</span><span class="token punctuation">(</span>yzm<span class="token punctuation">)</span><span class="token punctuation">,</span>
  35. <span class="token string">'next'</span><span class="token punctuation">:</span> <span class="token string">'/'</span>
  36. <span class="token punctuation">}</span>
  37. menu_response <span class="token operator">=</span> session<span class="token punctuation">.</span>post<span class="token punctuation">(</span>url <span class="token operator">=</span> login_url<span class="token punctuation">,</span>headers <span class="token operator">=</span> headers<span class="token punctuation">,</span>data <span class="token operator">=</span> data<span class="token punctuation">)</span>
  38. <span class="token comment">#上午体温补填</span>
  39. tmpam_url <span class="token operator">=</span> <span class="token string">'填体温页面地址'</span>
  40. headers <span class="token operator">=</span> <span class="token punctuation">{<!-- --></span>
  41. <span class="token string">'User-agent'</span><span class="token punctuation">:</span> <span class="token string">'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.106 Safari/537.36'</span><span class="token punctuation">,</span>
  42. <span class="token string">'Referer'</span><span class="token punctuation">:</span> <span class="token string">'填体温页面使用抓包工具查找到的referer地址(发起请求的前一个页面地址)'</span><span class="token punctuation">,</span>
  43. <span class="token punctuation">}</span>
  44. responseam <span class="token operator">=</span> session<span class="token punctuation">.</span>get<span class="token punctuation">(</span>url <span class="token operator">=</span> tmpam_url<span class="token punctuation">,</span>headers <span class="token operator">=</span> headers<span class="token punctuation">)</span>
  45. amtree <span class="token operator">=</span> etree<span class="token punctuation">.</span>HTML<span class="token punctuation">(</span>responseam<span class="token punctuation">.</span>text<span class="token punctuation">)</span>
  46. amcsrf <span class="token operator">=</span> amtree<span class="token punctuation">.</span>xpath<span class="token punctuation">(</span><span class="token string">'上午体温补填页面csrf的xpath表达式'</span><span class="token punctuation">)</span><span class="token punctuation">[</span><span class="token number">0</span><span class="token punctuation">]</span>
  47. amdata <span class="token operator">=</span> <span class="token punctuation">{<!-- --></span>
  48. <span class="token string">'csrfmiddlewaretoken'</span><span class="token punctuation">:</span> amcsrf<span class="token punctuation">,</span>
  49. <span class="token string">'tw'</span><span class="token punctuation">:</span><span class="token string">'36.5'</span><span class="token punctuation">,</span>
  50. <span class="token string">'fl'</span><span class="token punctuation">:</span> <span class="token string">'False'</span><span class="token punctuation">,</span>
  51. <span class="token string">'gk'</span><span class="token punctuation">:</span> <span class="token string">'False'</span><span class="token punctuation">,</span>
  52. <span class="token string">'hx'</span><span class="token punctuation">:</span> <span class="token string">'False'</span><span class="token punctuation">,</span>
  53. <span class="token string">'qt'</span><span class="token punctuation">:</span> <span class="token string">'False'</span><span class="token punctuation">,</span>
  54. <span class="token string">'jc'</span><span class="token punctuation">:</span> <span class="token string">'False'</span><span class="token punctuation">,</span>
  55. <span class="token string">'fx'</span><span class="token punctuation">:</span> <span class="token string">'False'</span><span class="token punctuation">,</span>
  56. <span class="token string">'jqjc'</span><span class="token punctuation">:</span><span class="token string">''</span><span class="token punctuation">,</span>
  57. <span class="token string">'lc'</span><span class="token punctuation">:</span><span class="token string">''</span><span class="token punctuation">,</span>
  58. <span class="token string">'actionName'</span><span class="token punctuation">:</span> <span class="token string">'actionValue'</span>
  59. <span class="token punctuation">}</span>
  60. session<span class="token punctuation">.</span>post<span class="token punctuation">(</span>url <span class="token operator">=</span> tmpam_url<span class="token punctuation">,</span>headers <span class="token operator">=</span> headers<span class="token punctuation">,</span>data <span class="token operator">=</span> amdata<span class="token punctuation">)</span>
  61. <span class="token comment">#下午体温补填</span>
  62. tmppm_url <span class="token operator">=</span> <span class="token string">'下午填体温页面地址'</span>
  63. headers <span class="token operator">=</span> <span class="token punctuation">{<!-- --></span>
  64. <span class="token string">'User-agent'</span><span class="token punctuation">:</span> <span class="token string">'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.106 Safari/537.36'</span><span class="token punctuation">,</span>
  65. <span class="token string">'Referer'</span><span class="token punctuation">:</span> <span class="token string">'同上所讲(可能没说清,可以去百度)'</span><span class="token punctuation">,</span>
  66. <span class="token punctuation">}</span>
  67. responsepm <span class="token operator">=</span> session<span class="token punctuation">.</span>get<span class="token punctuation">(</span>url<span class="token operator">=</span>tmppm_url<span class="token punctuation">,</span> headers<span class="token operator">=</span>headers<span class="token punctuation">)</span>
  68. pmtree <span class="token operator">=</span> etree<span class="token punctuation">.</span>HTML<span class="token punctuation">(</span>responsepm<span class="token punctuation">.</span>text<span class="token punctuation">)</span>
  69. pmcsrf <span class="token operator">=</span> pmtree<span class="token punctuation">.</span>xpath<span class="token punctuation">(</span><span class="token string">'下午体温补填页面csrf的xpath表达式'</span><span class="token punctuation">)</span><span class="token punctuation">[</span><span class="token number">0</span><span class="token punctuation">]</span>
  70. pmdata <span class="token operator">=</span> <span class="token punctuation">{<!-- --></span>
  71. <span class="token string">'csrfmiddlewaretoken'</span><span class="token punctuation">:</span> pmcsrf<span class="token punctuation">,</span>
  72. <span class="token string">'tw'</span><span class="token punctuation">:</span> <span class="token string">'36.4'</span><span class="token punctuation">,</span>
  73. <span class="token string">'fl'</span><span class="token punctuation">:</span> <span class="token string">'False'</span><span class="token punctuation">,</span>
  74. <span class="token string">'gk'</span><span class="token punctuation">:</span> <span class="token string">'False'</span><span class="token punctuation">,</span>
  75. <span class="token string">'hx'</span><span class="token punctuation">:</span> <span class="token string">'False'</span><span class="token punctuation">,</span>
  76. <span class="token string">'qt'</span><span class="token punctuation">:</span> <span class="token string">'False'</span><span class="token punctuation">,</span>
  77. <span class="token string">'jc'</span><span class="token punctuation">:</span> <span class="token string">'False'</span><span class="token punctuation">,</span>
  78. <span class="token string">'fx'</span><span class="token punctuation">:</span> <span class="token string">'False'</span><span class="token punctuation">,</span>
  79. <span class="token string">'jqjc'</span><span class="token punctuation">:</span> <span class="token string">''</span><span class="token punctuation">,</span>
  80. <span class="token string">'lc'</span><span class="token punctuation">:</span> <span class="token string">''</span><span class="token punctuation">,</span>
  81. <span class="token string">'actionName'</span><span class="token punctuation">:</span> <span class="token string">'actionValue'</span>
  82. <span class="token punctuation">}</span>
  83. session<span class="token punctuation">.</span>post<span class="token punctuation">(</span>url<span class="token operator">=</span>tmppm_url<span class="token punctuation">,</span> headers<span class="token operator">=</span>headers<span class="token punctuation">,</span> data<span class="token operator">=</span>pmdata<span class="token punctuation">)</span>

person1_tmpinput = tmp_input(username=“我女朋友的账号”,userpaw=“我女朋友的密码”)#如果没有女朋友就可以把这一行和下一行删掉
person1_tmpinput.tmp_in()
person1_tmpinput = tmp_input(username=“我的账号”,userpaw=“我的密码”)
person1_tmpinput.tmp_in()

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101

待补充

文章知识点与官方知识档案匹配,可进一步学习相关知识
Python入门技能树首页概览410818 人正在系统学习中
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/菜鸟追梦旅行/article/detail/423962
推荐阅读
相关标签
  

闽ICP备14008679号