pythonweb-scrapingscriptingmechanize

Using Python to automate the use of online file converter


How do I use Python to automate the file conversion of SBML (XML) files, stored locally, using a web-based file converter located here:
http://www.ebi.ac.uk/compneur-srv/converters/converters

Here are the steps for manually doing this:
1. Select "SBML" from the Model Format drop-down menu
2. Select "Octave" from the Output Format drop-down menu
3. Select the SBML file to upload OR Select the "copy/paste" button and paste SBML text contents into text box.
4. Click "Convert!" Button
5. Save converted output files on the next page


Solution

  • selenium seems to be an obvious answer, here's for example how you can "click" a link:

    from selenium import webdriver
    from selenium.common.exceptions import NoSuchElementException
    
    driver = webdriver.Firefox()
    driver.get("http://whatever")
    driver.find_element_by_link_text("link-text").click()
    

    As a side note, web admins are usually not happy about large scale automated activities, consider letting them know before you start.