0

I have a link say, "http://www.prt-inc.com/forecast.csv" I use this code to open the link

import webbrowser

webbrowser.open('http://www.prt-inc.com/forecast.csv')

Now this link opens a 'File Download' popup. The popup has 'open' 'save' 'cancel' on it.

I would like to write code that would 'click' on open or save and work with the file. But also I wouldn't want the link to physically open up in a browswer, just do it all in the background if possible. So I'm not sure if using 'webbrowser' is the proper thing to use. I am a beginner in python and not sure at all where to start or if there is different libraries to use to do this type of thing. If I could get some hints or tips, or get pointed in the right direction that would be great.

aliciamh
  • 1
  • 1

1 Answers1

0

If you need to work with the file I think you'd be better off using the urllib2 library

import urllib2
urllib2.urlopen("http://google.com").read()

This is assuming you have python 2.x. Python 3.x has some slight variations