Jul-12-2017, 08:21 PM
Hi,
This is a similar question to what I posted earlier, however I've made some improvements and my function is (almost) doing what I want it to do. This code below is opening the same url that contains different data every time it opens, every 3 seconds and retrieving the text from it. However, every time the URL opens I would like a separate text file for the results, right now it updates the "testing.txt" file and saves the latest result from when I close exit the function.
I'd like a separate file for each 3 second interval, but if all results are stored into one master text file that works for me as well. Any and all help is welcome, thank you!!
This is a similar question to what I posted earlier, however I've made some improvements and my function is (almost) doing what I want it to do. This code below is opening the same url that contains different data every time it opens, every 3 seconds and retrieving the text from it. However, every time the URL opens I would like a separate text file for the results, right now it updates the "testing.txt" file and saves the latest result from when I close exit the function.
I'd like a separate file for each 3 second interval, but if all results are stored into one master text file that works for me as well. Any and all help is welcome, thank you!!
import webbrowser import schedule import time import urllib def job(): webbrowser.open('http://127.0.0.1:56781/mavlink/') urllib.urlretrieve('http://127.0.0.1:56781/mavlink/', "testing.txt") schedule.every(3).seconds.do(job) while 1: schedule.run_pending() time.sleep(1)