Home  >  Q&A  >  body text

python - requests下载图片出错超时?

今天突然发现获取微信头像出现了超时问题

requests.get('http://wx.qlogo.cn/mmopen/0wR...')

我在本地没有问题。
但是在服务器却有问题,这个代码会一直卡住。有人知道什么原因吗?
是不是下载图片需要开启某个端口呀!!有人知道是什么端口吗?

黄舟黄舟2765 days ago685

reply all(1)I'll reply

  • 大家讲道理

    大家讲道理2017-04-18 10:14:00

    1. You can log in to that server first and use the requests library to get it manually. If it doesn’t work, try “2”

    2. wget that picture, if not, try "3"

    3. The picture resource is on the http server. You can ping "wx.qlogo.cn" now. Judging from the domain name, it should be the domain name of WeChat. There may be no problem. Then telnet wx.qlogo.cn 80 on the server. If it still doesn't work, it means there is a problem with the network. You can check the firewall information of this server.

    reply
    0
  • Cancelreply