I want to automate the data download process(via Python) from specific websites but cannot use Selenium or a browser, since the code would be scheduled on a server where both selenium and browser options are not available.
I tried a python code using pyautogui package to automate mouse movement n click to download the file, but it wouldn't work since server would not allow opening a browser option (and i can't use Selenium as well, which would be the ideal option)
attaching the code below:
import time
import webbrowser
url = 'https://covid.cdc.gov/covid-data-tracker/#ed-visits'
#Open URL in a new tab, if a browser window is already open*
webbrowser.open_new_tab(url)
print(pyautogui.size())
time.sleep(5)
pyautogui.moveTo(1275, 655, duration = 5)
pyautogui.click()
time.sleep(5)
pyautogui.press('down')
pyautogui.press('enter')
I would like a bit of help on the other ways this can be achieved. Given the above limitations, how can i automate the file download, such that I run/schedule a .py file on the server side to automate this process.
I tried to follow @Olvin Roght's answer but could not find the triggered function or the file source for the csv : Is there any way to download csv file from “website button click” using Python?
Attaching the snap of that as well: