import pandas as pd
from pandas.core.dtypes.dtypes import register_extension_dtype
from sqlalchemy import create_engine, engine
engine = create_engine(‘mysql+pymysql://root:mysql@localhost:3306/xxx‘)
from datetime import datetime
import hashlib
from urllib.parse import unquote, quote
import requests
df = pd.read_csv(‘a.csv‘)
a = 0
for i in df[‘REGNO‘]:
a = a +1
imgurl = sign_md5s(‘BrandInfoFind/GetBrandInfoImg‘, {"RegId": i})
try:
filename = ‘image/‘ +str(i) + ‘.jpg‘
pic = requests.get(imgurl)
if pic.status_code == 200:
with open(filename, ‘wb‘) as fp:
fp.write(pic.content)
fp.close()
if a % 2500 == 0:
print("成功输出类别:",int(a/2500)+1)
except:
print(‘获取图片失败‘,i)
原文:https://www.cnblogs.com/mumuzifeng/p/15095622.html