I have a url which I need to run in order for a refresh to happen. It will refresh the data cache and display the latest uploaded data in tableau server. The url is like this:
http://servername/views/workbookname/dashboard1?:refresh=yes
When I use the webbrowser library to open the url, the refresh is executed but I get a browser which is open. When I use requests to get the url, it does not refresh and gives me a Response of 200 which I assume is successful.
Anyone knows why it could happen? How can I silently use the webbrowser lib to open the url and close it afterwards or have the requests act as a webbrowser when doing the get function?
import webbrowser
url = 'http://servername/views/workbookname/dashboard1?:refresh=yes'
webbrowser.open(url)
import requests
url = "http://servername/views/workbookname/dashboard1?:refresh=yes"
headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.76 Safari/537.36', "Upgrade-Insecure-Requests": "1","DNT": "1","Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8","Accept-Language": "en-US,en;q=0.5","Accept-Encoding": "gzip, deflate"}
html = requests.get(url,headers=headers)
print(html)