Script to download website source to a folder
Question: I am trying to learn simple automation. I have set up an Ubuntu Server and I
want to configure it to download html source from a specific URL and append to
a file in a specified folder on the server every 1 minute.

The URL is just basic html with no CSS whatsoever.

I want to use python but admittedly can use any language. What is a good,
simple day to do this?


Answer: Just pip install the requests library.

    
    
    $ pip install requests
    

Then, it's super easy to get the HTML (put this in a file called get_html.py,
or whatever name you like):

    
    
    import requests
    
    req = requests.get('http://docs.python-requests.org/en/latest/user/quickstart/')
    
    print(req.text)
    

There are a variety of options for saving the HTML to a directory. For
example, you could redirect the output from the above script to a file by
calling it like this:

    
    
     python get_html.py > file.html
    

Hope this helps

