How to download this GIF(dynamic) by Python?
Question: I give an url as example:

    
    
    http://ww4.sinaimg.cn/large/a7bf601fjw1f7jsbj34a1g20kc0bdnph.gif
    

You can see it in your browser.

Now I want to download it. I **have tried** :

1.

`urllib.urlretrieve(imgurl,filepath')`

failed, got an "error" picture.

2.

`wget.download(imgurl)`

failed, got an "error" picture.

3.

`r = requests.get(imgurl,stream=True) img =
PIL.Image.open(StringIO(r.content)) img.save(filepath)`

failed, got a static picture, I mean, just one frame.

**So what should I do?**


Answer: This works quite fine for me, to get the animated gif:

    
    
    >>> import requests
    >>> uri = 'http://ww4.sinaimg.cn/large/a7bf601fjw1f7jsbj34a1g20kc0bdnph.gif'
    >>> with open('/tmp/pr0n.gif', 'wb') as f:
    ...     f.write(requests.get(uri).content)
    ...     
    

Happy fapping!

