码迷,mamicode.com
首页 > 其他好文 > 详细

requests获取图片的宽和高

时间:2019-05-21 19:35:13      阅读:138      评论:0      收藏:0      [点我收藏+]

标签:exce   time   image   timeout   art   out   ima   ogg   pre   

try:
if cover:
resp = requests.get(‘%s?x-oss-process=image/info‘ % (url), timeout=30)
if resp.status_code == 200:
rj = resp.json()
article_data[‘c_h‘] = float(rj[‘ImageHeight‘][‘value‘])
article_data[‘c_w‘] = float(rj[‘ImageWidth‘][‘value‘])
except Exception as e:
logger.info(e)

requests获取图片的宽和高

标签:exce   time   image   timeout   art   out   ima   ogg   pre   

原文地址:https://www.cnblogs.com/quzq/p/10901622.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!