Elias Shourosh
Elias Shourosh

Reputation: 89

Clearing cache using urllib library in python

I am downloading an image from a given url via urllib by using the

urllib.urlretrieve(ImageUrl,ImageName)

My question is: is it possible to clear cache using urllib before downloading the image or do I have to first browse to image url,clear cache, then download the image via urllib.urlretrieve? I am using Python 2.7 ; browser: Chrome

Thanks in advance.

Upvotes: 0

Views: 2404

Answers (1)

Lewoniewski
Lewoniewski

Reputation: 106

You can try:

urllib.urlcleanup()

It clears the cache that may have been built up by previous calls to urlretrieve().

Source: https://docs.python.org/2/library/urllib.html

Upvotes: 1

Related Questions