-1

I want to be able to download all csv files in a specified path within Ambari file viewer that have a certain file name.

i.e. Open ambari file viewer on google chrome, log into ambari file viewer with username and password, navigate to a specified folder in ambari, download all relevant csv files based on file name using wildcards (e.g. file__20191231.csv), place files in a specified windows folder

Rafid Reaz
  • 117
  • 2
  • 10

1 Answers1

0

Seems very doable, I'm not exactly sure what your question is though and I'm not familiar with Ambari. To tackle a project like this I suggest the following steps:

Step 1: Research Selenium and practice things like logging into a social media or another web account.

Step 2: Specifically look at the section for identifying items by id, class, and xpath. Check the html of Ambari and see if the id's or classes seem reliable for the elements you need to interact with (ie. username & password fields).Use xpath if you must.

Step 3: Find the column/container that the files are displayed in and create a loop to pull the text out of each container. Add page pagination if needed.

Step 4: use python to read each text as it is viewed, if it contains the substring you desire, ask selenium to right click the element it just visited and download (or click the corresponding download button if available).

Step 5: Move the file from your downloads folder to your desired folder on your machine with os and shutil there's another thread about doing this here

P.S. You'll need a compatable chromedriver.exe to run selenium with chrome. Again, view the selenium docs to learn more about python-selenium and setting it up.

Hope this helps