Python3.x:获取登录界面校验码图片
实例代码:
# python3 # author lizm # datetime 2018-06-01 18:00:00 # -*- coding: utf-8 -*- ‘‘‘ oa:http://******/login/loginpage.do ‘‘‘ from splinter.browser import Browser from time import sleep # traceback模块被用来跟踪异常返回信息 import traceback import urllib import urllib.request #获取校验码图片 def getImage(imgUrl): request = urllib.request.Request(imgUrl) response = urllib.request.urlopen(request) get_img = response.read() with open(‘001.jpg‘,‘wb‘) as fp: fp.write(get_img) print(‘校验码下载完成‘) return if __name__ == "__main__": getImage(‘http://******/views/randomImage.jsp?Rand=5964.904004367221‘)
原文地址:https://www.cnblogs.com/lizm166/p/9121552.html
时间: 2024-10-13 19:15:03