'Getting filename while downloading a file using http request method in python

I am using request.get(url) to download a file from web.In url the filename is not present.Is there any way to get the filename. I am using below code to get the filename but no luck.

image_url = url
  
# # URL of the image to be downloaded is defined as image_url
r = requests.get(image_url) # create HTTP response object
print(r.headers.get('content-disposition'))


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source