Reputation: 125
I have a link that gives me a "save as" dialog box for a .pst file every time I run it. I want to try to save the file to a 'sample.txt' file without opening it since the size is 500 MB.
Is there any way to get around this..?
import urllib
jsonl = urllib.request.urlopen("test.com/csv?date=2019-07-17")
I have tried the code above but it gives me
<http.client.HTTPResponse at 0x9ac4k10>
Upvotes: 0
Views: 1927
Reputation: 125
Ok so I had a lot of trouble interacting with the site. I decided to just go with the webbrowser library.
import webbrowser
chrome_path="C:xxx\\Google\\Chrome\\Application\\chrome.exe"
webbrowser.register('chrome', None,webbrowser.BackgroundBrowser(chrome_path))
url = 'http://testsite/csv?date=2019-07-18'
Setting chrome to download files automatically populates my download folder from where i can automate everything else :)
Upvotes: 1
Reputation: 1648
You need to read the data out of the object that urlopen returns.
Try
import urllib
with urllib.request.urlopen("test.com/csv?date=2019-07-17") as f:
jsonl = f.read()
Upvotes: 1