I am trying to isolate the first row in a table using python and bs4. Within the first row I would like to pull the data and write it to a csv file with the associated time and date.
import bs4
from urllib.request import urlopen as u_req
from bs4 import BeautifulSoup as soup
import requests
import csv
my_url = 'http://mis.ercot.com/misapp/GetReports.do?reportTypeId=11485&reportTitle=LMPs%20by%20Electrical%20Bus&showHTMLView=&mimicKey/'
#opening up connection, grabbing the page
uClient = u_req(my_url)
page_html = uClient.read()
uClient.close()
page_soup = soup(page_html, "html.parser")
#find rows in ercot 5 min historical data
ercot_row_saved=""
for record in page_soup.findAll('tr'):
print(record.text)
A new link is loaded to the site every five minutes, ultimately I would like the program to run every five minutes to capture the data in the csv file. the above code gets me to all the data in a text file. Any help would be appreciated.