import requests
import time
from config import URL
from config import LOCATION
from bs4 import BeautifulSoup

raw_html = requests.get(URL).text
data = BeautifulSoup(raw_html, 'html.parser')

tl = (data.select('h2')[1])
tl = (tl.encode_contents())
tl = tl.rstrip(' <span id="displayDate"></span>')

if (data.select('td')[0].text[0:5]) == "High" or (data.select('td')[0].text[0:5]) == "Low":
    hl0 = (data.select('td')[0].text[0:5])
    hl = 1
else:
	print ("ERROR 0")

if (data.select('td')[1].text[0:5]) == "High" or (data.select('td')[1].text[0:5]) == "Low":
    hl1 = (data.select('td')[1].text[0:5])
    hl = 2
else:
	print ("ERROR 1")

if (data.select('td')[2].text[0:5]) == "High" or (data.select('td')[2].text[0:5]) == "Low":
    hl2 = (data.select('td')[2].text[0:5])
    hl = 3
else:
	print ("ERROR 2")

if (data.select('td')[3].text[0:5]) == "High" or (data.select('td')[3].text[0:5]) == "Low":
    hl3 = (data.select('td')[3].text[0:5])
    hl = 4
else:
	if (data.select('td')[15].text[0:5]) == "High" or (data.select('td')[15].text[0:5]) == "Low":
		# 3 tide times today and 4 tide times tomorrow
		hl3 = (data.select('td')[12].text[0:5])
		hl4 = (data.select('td')[13].text[0:5])
		hl5 = (data.select('td')[14].text[0:5])
		tt0 = (data.select('td')[3].text[0:5])
		tt1 = (data.select('td')[4].text[0:5])
		tt2 = (data.select('td')[5].text[0:5])
		tt3 = (data.select('td')[16].text[0:5])
		tt4 = (data.select('td')[17].text[0:5])
		tt5 = (data.select('td')[18].text[0:5])
		th0 = (data.select('td')[6].text[0:4])
		th0 = th0.rstrip()
		th1 = (data.select('td')[7].text[0:4])
		th1 = th1.rstrip()
		th2 = (data.select('td')[8].text[0:4])
		th2 = th2.rstrip()
		th3 = (data.select('td')[20].text[0:4])
		th3 = th3.rstrip()
		th4 = (data.select('td')[21].text[0:4])
		th4 = th4.rstrip()
		th5 = (data.select('td')[22].text[0:4])
		th5 = th5.rstrip()
		text_file = open("%s/tidestore.py" % LOCATION, "w")
		text_file.write("tl = '%s'" % tl)
		text_file.write("\nhl = '%s'" % hl)
		text_file.write("\nhl0 = '%s'" % hl0)
		text_file.write("\nhl1 = '%s'" % hl1)
		text_file.write("\nhl2 = '%s'" % hl2)
		text_file.write("\nhl3 = '%s'" % hl3)
		text_file.write("\nhl4 = '%s'" % hl4)
		text_file.write("\nhl5 = '%s'" % hl5)
		text_file.write("\ntt0 = '%s'" % tt0)
		text_file.write("\ntt1 = '%s'" % tt1)
		text_file.write("\ntt2 = '%s'" % tt2)
		text_file.write("\ntt3 = '%s'" % tt3)
		text_file.write("\ntt4 = '%s'" % tt4)
		text_file.write("\ntt5 = '%s'" % tt5)
		text_file.write("\nth0 = '%s'" % th0)
		text_file.write("\nth1 = '%s'" % th1)
		text_file.write("\nth2 = '%s'" % th2)
		text_file.write("\nth3 = '%s'" % th3)
		text_file.write("\nth4 = '%s'" % th4)
		text_file.write("\nth5 = '%s'" % th5)
		text_file.close()
		time.sleep(150)
		text_file = open("%s/tidestorex.py" % LOCATION, "w")
		text_file.write("tl = '%s'" % tl)
		text_file.write("\nhl = '%s'" % hl)
		text_file.write("\nhlx0 = '%s'" % hl0)
		text_file.write("\nhlx1 = '%s'" % hl1)
		text_file.write("\nhlx2 = '%s'" % hl2)
		text_file.write("\nhlx3 = '%s'" % hl3)
		text_file.write("\nhlx4 = '%s'" % hl4)
		text_file.write("\nhlx5 = '%s'" % hl5)
		text_file.write("\nttx0 = '%s'" % tt0)
		text_file.write("\nttx1 = '%s'" % tt1)
		text_file.write("\nttx2 = '%s'" % tt2)
		text_file.write("\nttx3 = '%s'" % tt3)
		text_file.write("\nttx4 = '%s'" % tt4)
		text_file.write("\nttx5 = '%s'" % tt5)
		text_file.write("\nthx0 = '%s'" % th0)
		text_file.write("\nthx1 = '%s'" % th1)
		text_file.write("\nthx2 = '%s'" % th2)
		text_file.write("\nthx3 = '%s'" % th3)
		text_file.write("\nthx4 = '%s'" % th4)
		text_file.write("\nthx5 = '%s'" % th5)
		text_file.close()
		quit()
	else:
		# 3 tide times today and 3 tide times tomorrow
		hl3 = (data.select('td')[12].text[0:5])
		hl4 = (data.select('td')[13].text[0:5])
		hl5 = (data.select('td')[14].text[0:5])
		tt0 = (data.select('td')[3].text[0:5])
		tt1 = (data.select('td')[4].text[0:5])
		tt2 = (data.select('td')[5].text[0:5])
		tt3 = (data.select('td')[15].text[0:5])
		tt4 = (data.select('td')[16].text[0:5])
		tt5 = (data.select('td')[17].text[0:5])
		th0 = (data.select('td')[6].text[0:4])
		th0 = th0.rstrip()
		th1 = (data.select('td')[7].text[0:4])
		th1 = th1.rstrip()
		th2 = (data.select('td')[8].text[0:4])
		th2 = th2.rstrip()
		th3 = (data.select('td')[18].text[0:4])
		th3 = th3.rstrip()
		th4 = (data.select('td')[19].text[0:4])
		th4 = th4.rstrip()
		th5 = (data.select('td')[20].text[0:4])
		th5 = th5.rstrip()
		text_file = open("%s/tidestore.py" % LOCATION, "w")
		text_file.write("tl = '%s'" % tl)
		text_file.write("\nhl = '%s'" % hl)
		text_file.write("\nhl0 = '%s'" % hl0)
		text_file.write("\nhl1 = '%s'" % hl1)
		text_file.write("\nhl2 = '%s'" % hl2)
		text_file.write("\nhl3 = '%s'" % hl3)
		text_file.write("\nhl4 = '%s'" % hl4)
		text_file.write("\nhl5 = '%s'" % hl5)
		text_file.write("\ntt0 = '%s'" % tt0)
		text_file.write("\ntt1 = '%s'" % tt1)
		text_file.write("\ntt2 = '%s'" % tt2)
		text_file.write("\ntt3 = '%s'" % tt3)
		text_file.write("\ntt4 = '%s'" % tt4)
		text_file.write("\ntt5 = '%s'" % tt5)
		text_file.write("\nth0 = '%s'" % th0)
		text_file.write("\nth1 = '%s'" % th1)
		text_file.write("\nth2 = '%s'" % th2)
		text_file.write("\nth3 = '%s'" % th3)
		text_file.write("\nth4 = '%s'" % th4)
		text_file.write("\nth5 = '%s'" % th5)
		text_file.close()
		time.sleep(150)
		text_file = open("%s/tidestorex.py" % LOCATION, "w")
		text_file.write("tl = '%s'" % tl)
		text_file.write("\nhl = '%s'" % hl)
		text_file.write("\nhlx0 = '%s'" % hl0)
		text_file.write("\nhlx1 = '%s'" % hl1)
		text_file.write("\nhlx2 = '%s'" % hl2)
		text_file.write("\nhlx3 = '%s'" % hl3)
		text_file.write("\nhlx4 = '%s'" % hl4)
		text_file.write("\nhlx5 = '%s'" % hl5)
		text_file.write("\nttx0 = '%s'" % tt0)
		text_file.write("\nttx1 = '%s'" % tt1)
		text_file.write("\nttx2 = '%s'" % tt2)
		text_file.write("\nttx3 = '%s'" % tt3)
		text_file.write("\nttx4 = '%s'" % tt4)
		text_file.write("\nttx5 = '%s'" % tt5)
		text_file.write("\nthx0 = '%s'" % th0)
		text_file.write("\nthx1 = '%s'" % th1)
		text_file.write("\nthx2 = '%s'" % th2)
		text_file.write("\nthx3 = '%s'" % th3)
		text_file.write("\nthx4 = '%s'" % th4)
		text_file.write("\nthx5 = '%s'" % th5)
		text_file.close()
		quit()
if (data.select('td')[4].text[0:5]) == "High" or (data.select('td')[4].text[0:5]) == "Low":
    hl4 = (data.select('td')[4].text[0:5])
    hl = 5
else:
	if (data.select('td')[18].text[0:5]) == "High" or (data.select('td')[18].text[0:5]) == "Low":
		# 4 tide times today and 4 tide times tomorrow
		hl4 = (data.select('td')[15].text[0:5])
		hl5 = (data.select('td')[16].text[0:5])
		hl6 = (data.select('td')[17].text[0:5])
		tt0 = (data.select('td')[4].text[0:5])
		tt1 = (data.select('td')[5].text[0:5])
		tt2 = (data.select('td')[6].text[0:5])
		tt3 = (data.select('td')[7].text[0:5])
		tt4 = (data.select('td')[19].text[0:5])
		tt5 = (data.select('td')[20].text[0:5])
		tt6 = (data.select('td')[21].text[0:5])
		th0 = (data.select('td')[8].text[0:4])
		th0 = th0.rstrip()
		th1 = (data.select('td')[9].text[0:4])
		th1 = th1.rstrip()
		th2 = (data.select('td')[10].text[0:4])
		th2 = th2.rstrip()
		th3 = (data.select('td')[11].text[0:4])
		th3 = th3.rstrip()
		th4 = (data.select('td')[23].text[0:4])
		th4 = th4.rstrip()
		th5 = (data.select('td')[24].text[0:4])
		th5 = th5.rstrip()
		th6 = (data.select('td')[25].text[0:4])
		th6 = th6.rstrip()
		text_file = open("%s/tidestore.py" % LOCATION, "w")
		text_file.write("tl = '%s'" % tl)
		text_file.write("\nhl = '%s'" % hl)
		text_file.write("\nhl0 = '%s'" % hl0)
		text_file.write("\nhl1 = '%s'" % hl1)
		text_file.write("\nhl2 = '%s'" % hl2)
		text_file.write("\nhl3 = '%s'" % hl3)
		text_file.write("\nhl4 = '%s'" % hl4)
		text_file.write("\nhl5 = '%s'" % hl5)
		text_file.write("\nhl6 = '%s'" % hl6)
		text_file.write("\ntt0 = '%s'" % tt0)
		text_file.write("\ntt1 = '%s'" % tt1)
		text_file.write("\ntt2 = '%s'" % tt2)
		text_file.write("\ntt3 = '%s'" % tt3)
		text_file.write("\ntt4 = '%s'" % tt4)
		text_file.write("\ntt5 = '%s'" % tt5)
		text_file.write("\ntt6 = '%s'" % tt6)
		text_file.write("\nth0 = '%s'" % th0)
		text_file.write("\nth1 = '%s'" % th1)
		text_file.write("\nth2 = '%s'" % th2)
		text_file.write("\nth3 = '%s'" % th3)
		text_file.write("\nth4 = '%s'" % th4)
		text_file.write("\nth5 = '%s'" % th5)
		text_file.write("\nth6 = '%s'" % th6)
		text_file.close()
		time.sleep(150)
		text_file = open("%s/tidestorex.py" % LOCATION, "w")
		text_file.write("tl = '%s'" % tl)
		text_file.write("\nhl = '%s'" % hl)
		text_file.write("\nhlx0 = '%s'" % hl0)
		text_file.write("\nhlx1 = '%s'" % hl1)
		text_file.write("\nhlx2 = '%s'" % hl2)
		text_file.write("\nhlx3 = '%s'" % hl3)
		text_file.write("\nhlx4 = '%s'" % hl4)
		text_file.write("\nhlx5 = '%s'" % hl5)
		text_file.write("\nhlx6 = '%s'" % hl6)
		text_file.write("\nttx0 = '%s'" % tt0)
		text_file.write("\nttx1 = '%s'" % tt1)
		text_file.write("\nttx2 = '%s'" % tt2)
		text_file.write("\nttx3 = '%s'" % tt3)
		text_file.write("\nttx4 = '%s'" % tt4)
		text_file.write("\nttx5 = '%s'" % tt5)
		text_file.write("\nttx6 = '%s'" % tt6)
		text_file.write("\nthx0 = '%s'" % th0)
		text_file.write("\nthx1 = '%s'" % th1)
		text_file.write("\nthx2 = '%s'" % th2)
		text_file.write("\nthx3 = '%s'" % th3)
		text_file.write("\nthx4 = '%s'" % th4)
		text_file.write("\nthx5 = '%s'" % th5)
		text_file.write("\nthx6 = '%s'" % th6)
		text_file.close()
	else:
		# 4 tide times today and 3 tide times tomorrow
		hl4 = (data.select('td')[15].text[0:5])
		hl5 = (data.select('td')[16].text[0:5])
		hl6 = (data.select('td')[17].text[0:5])
		tt0 = (data.select('td')[4].text[0:5])
		tt1 = (data.select('td')[5].text[0:5])
		tt2 = (data.select('td')[6].text[0:5])
		tt3 = (data.select('td')[7].text[0:5])
		tt4 = (data.select('td')[18].text[0:5])
		tt5 = (data.select('td')[19].text[0:5])
		tt6 = (data.select('td')[20].text[0:5])
		th0 = (data.select('td')[8].text[0:4])
		th0 = th0.rstrip()
		th1 = (data.select('td')[9].text[0:4])
		th1 = th1.rstrip()
		th2 = (data.select('td')[10].text[0:4])
		th2 = th2.rstrip()
		th3 = (data.select('td')[11].text[0:4])
		th3 = th3.rstrip()
		th4 = (data.select('td')[21].text[0:4])
		th4 = th4.rstrip()
		th5 = (data.select('td')[22].text[0:4])
		th5 = th5.rstrip()
		th6 = (data.select('td')[23].text[0:4])
		th6 = th6.rstrip()
		text_file = open("%s/tidestore.py" % LOCATION, "w")
		text_file.write("tl = '%s'" % tl)
		text_file.write("\nhl = '%s'" % hl)
		text_file.write("\nhl0 = '%s'" % hl0)
		text_file.write("\nhl1 = '%s'" % hl1)
		text_file.write("\nhl2 = '%s'" % hl2)
		text_file.write("\nhl3 = '%s'" % hl3)
		text_file.write("\nhl4 = '%s'" % hl4)
		text_file.write("\nhl5 = '%s'" % hl5)
		text_file.write("\nhl6 = '%s'" % hl6)
		text_file.write("\ntt0 = '%s'" % tt0)
		text_file.write("\ntt1 = '%s'" % tt1)
		text_file.write("\ntt2 = '%s'" % tt2)
		text_file.write("\ntt3 = '%s'" % tt3)
		text_file.write("\ntt4 = '%s'" % tt4)
		text_file.write("\ntt5 = '%s'" % tt5)
		text_file.write("\ntt6 = '%s'" % tt6)
		text_file.write("\nth0 = '%s'" % th0)
		text_file.write("\nth1 = '%s'" % th1)
		text_file.write("\nth2 = '%s'" % th2)
		text_file.write("\nth3 = '%s'" % th3)
		text_file.write("\nth4 = '%s'" % th4)
		text_file.write("\nth5 = '%s'" % th5)
		text_file.write("\nth6 = '%s'" % th6)
		text_file.close()
		time.sleep(150)
		text_file = open("%s/tidestorex.py" % LOCATION, "w")
		text_file.write("tl = '%s'" % tl)
		text_file.write("\nhl = '%s'" % hl)
		text_file.write("\nhlx0 = '%s'" % hl0)
		text_file.write("\nhlx1 = '%s'" % hl1)
		text_file.write("\nhlx2 = '%s'" % hl2)
		text_file.write("\nhlx3 = '%s'" % hl3)
		text_file.write("\nhlx4 = '%s'" % hl4)
		text_file.write("\nhlx5 = '%s'" % hl5)
		text_file.write("\nhlx6 = '%s'" % hl6)
		text_file.write("\nttx0 = '%s'" % tt0)
		text_file.write("\nttx1 = '%s'" % tt1)
		text_file.write("\nttx2 = '%s'" % tt2)
		text_file.write("\nttx3 = '%s'" % tt3)
		text_file.write("\nttx4 = '%s'" % tt4)
		text_file.write("\nttx5 = '%s'" % tt5)
		text_file.write("\nttx6 = '%s'" % tt6)
		text_file.write("\nthx0 = '%s'" % th0)
		text_file.write("\nthx1 = '%s'" % th1)
		text_file.write("\nthx2 = '%s'" % th2)
		text_file.write("\nthx3 = '%s'" % th3)
		text_file.write("\nthx4 = '%s'" % th4)
		text_file.write("\nthx5 = '%s'" % th5)
		text_file.write("\nthx6 = '%s'" % th6)
		text_file.close()

3e66d928167468e45ae6c6962af56cbc8326a339
<mask token>

<mask token>
if data.select('td')[0].text[0:5] == 'High' or data.select('td')[0].text[0:5
    ] == 'Low':
    hl0 = data.select('td')[0].text[0:5]
    hl = 1
else:
    print('ERROR 0')
if data.select('td')[1].text[0:5] == 'High' or data.select('td')[1].text[0:5
    ] == 'Low':
    hl1 = data.select('td')[1].text[0:5]
    hl = 2
else:
    print('ERROR 1')
if data.select('td')[2].text[0:5] == 'High' or data.select('td')[2].text[0:5
    ] == 'Low':
    hl2 = data.select('td')[2].text[0:5]
    hl = 3
else:
    print('ERROR 2')
if data.select('td')[3].text[0:5] == 'High' or data.select('td')[3].text[0:5
    ] == 'Low':
    hl3 = data.select('td')[3].text[0:5]
    hl = 4
elif data.select('td')[15].text[0:5] == 'High' or data.select('td')[15].text[
    0:5] == 'Low':
    hl3 = data.select('td')[12].text[0:5]
    hl4 = data.select('td')[13].text[0:5]
    hl5 = data.select('td')[14].text[0:5]
    tt0 = data.select('td')[3].text[0:5]
    tt1 = data.select('td')[4].text[0:5]
    tt2 = data.select('td')[5].text[0:5]
    tt3 = data.select('td')[16].text[0:5]
    tt4 = data.select('td')[17].text[0:5]
    tt5 = data.select('td')[18].text[0:5]
    th0 = data.select('td')[6].text[0:4]
    th0 = th0.rstrip()
    th1 = data.select('td')[7].text[0:4]
    th1 = th1.rstrip()
    th2 = data.select('td')[8].text[0:4]
    th2 = th2.rstrip()
    th3 = data.select('td')[20].text[0:4]
    th3 = th3.rstrip()
    th4 = data.select('td')[21].text[0:4]
    th4 = th4.rstrip()
    th5 = data.select('td')[22].text[0:4]
    th5 = th5.rstrip()
    text_file = open('%s/tidestore.py' % LOCATION, 'w')
    text_file.write("tl = '%s'" % tl)
    text_file.write("\nhl = '%s'" % hl)
    text_file.write("\nhl0 = '%s'" % hl0)
    text_file.write("\nhl1 = '%s'" % hl1)
    text_file.write("\nhl2 = '%s'" % hl2)
    text_file.write("\nhl3 = '%s'" % hl3)
    text_file.write("\nhl4 = '%s'" % hl4)
    text_file.write("\nhl5 = '%s'" % hl5)
    text_file.write("\ntt0 = '%s'" % tt0)
    text_file.write("\ntt1 = '%s'" % tt1)
    text_file.write("\ntt2 = '%s'" % tt2)
    text_file.write("\ntt3 = '%s'" % tt3)
    text_file.write("\ntt4 = '%s'" % tt4)
    text_file.write("\ntt5 = '%s'" % tt5)
    text_file.write("\nth0 = '%s'" % th0)
    text_file.write("\nth1 = '%s'" % th1)
    text_file.write("\nth2 = '%s'" % th2)
    text_file.write("\nth3 = '%s'" % th3)
    text_file.write("\nth4 = '%s'" % th4)
    text_file.write("\nth5 = '%s'" % th5)
    text_file.close()
    time.sleep(150)
    text_file = open('%s/tidestorex.py' % LOCATION, 'w')
    text_file.write("tl = '%s'" % tl)
    text_file.write("\nhl = '%s'" % hl)
    text_file.write("\nhlx0 = '%s'" % hl0)
    text_file.write("\nhlx1 = '%s'" % hl1)
    text_file.write("\nhlx2 = '%s'" % hl2)
    text_file.write("\nhlx3 = '%s'" % hl3)
    text_file.write("\nhlx4 = '%s'" % hl4)
    text_file.write("\nhlx5 = '%s'" % hl5)
    text_file.write("\nttx0 = '%s'" % tt0)
    text_file.write("\nttx1 = '%s'" % tt1)
    text_file.write("\nttx2 = '%s'" % tt2)
    text_file.write("\nttx3 = '%s'" % tt3)
    text_file.write("\nttx4 = '%s'" % tt4)
    text_file.write("\nttx5 = '%s'" % tt5)
    text_file.write("\nthx0 = '%s'" % th0)
    text_file.write("\nthx1 = '%s'" % th1)
    text_file.write("\nthx2 = '%s'" % th2)
    text_file.write("\nthx3 = '%s'" % th3)
    text_file.write("\nthx4 = '%s'" % th4)
    text_file.write("\nthx5 = '%s'" % th5)
    text_file.close()
    quit()
else:
    hl3 = data.select('td')[12].text[0:5]
    hl4 = data.select('td')[13].text[0:5]
    hl5 = data.select('td')[14].text[0:5]
    tt0 = data.select('td')[3].text[0:5]
    tt1 = data.select('td')[4].text[0:5]
    tt2 = data.select('td')[5].text[0:5]
    tt3 = data.select('td')[15].text[0:5]
    tt4 = data.select('td')[16].text[0:5]
    tt5 = data.select('td')[17].text[0:5]
    th0 = data.select('td')[6].text[0:4]
    th0 = th0.rstrip()
    th1 = data.select('td')[7].text[0:4]
    th1 = th1.rstrip()
    th2 = data.select('td')[8].text[0:4]
    th2 = th2.rstrip()
    th3 = data.select('td')[18].text[0:4]
    th3 = th3.rstrip()
    th4 = data.select('td')[19].text[0:4]
    th4 = th4.rstrip()
    th5 = data.select('td')[20].text[0:4]
    th5 = th5.rstrip()
    text_file = open('%s/tidestore.py' % LOCATION, 'w')
    text_file.write("tl = '%s'" % tl)
    text_file.write("\nhl = '%s'" % hl)
    text_file.write("\nhl0 = '%s'" % hl0)
    text_file.write("\nhl1 = '%s'" % hl1)
    text_file.write("\nhl2 = '%s'" % hl2)
    text_file.write("\nhl3 = '%s'" % hl3)
    text_file.write("\nhl4 = '%s'" % hl4)
    text_file.write("\nhl5 = '%s'" % hl5)
    text_file.write("\ntt0 = '%s'" % tt0)
    text_file.write("\ntt1 = '%s'" % tt1)
    text_file.write("\ntt2 = '%s'" % tt2)
    text_file.write("\ntt3 = '%s'" % tt3)
    text_file.write("\ntt4 = '%s'" % tt4)
    text_file.write("\ntt5 = '%s'" % tt5)
    text_file.write("\nth0 = '%s'" % th0)
    text_file.write("\nth1 = '%s'" % th1)
    text_file.write("\nth2 = '%s'" % th2)
    text_file.write("\nth3 = '%s'" % th3)
    text_file.write("\nth4 = '%s'" % th4)
    text_file.write("\nth5 = '%s'" % th5)
    text_file.close()
    time.sleep(150)
    text_file = open('%s/tidestorex.py' % LOCATION, 'w')
    text_file.write("tl = '%s'" % tl)
    text_file.write("\nhl = '%s'" % hl)
    text_file.write("\nhlx0 = '%s'" % hl0)
    text_file.write("\nhlx1 = '%s'" % hl1)
    text_file.write("\nhlx2 = '%s'" % hl2)
    text_file.write("\nhlx3 = '%s'" % hl3)
    text_file.write("\nhlx4 = '%s'" % hl4)
    text_file.write("\nhlx5 = '%s'" % hl5)
    text_file.write("\nttx0 = '%s'" % tt0)
    text_file.write("\nttx1 = '%s'" % tt1)
    text_file.write("\nttx2 = '%s'" % tt2)
    text_file.write("\nttx3 = '%s'" % tt3)
    text_file.write("\nttx4 = '%s'" % tt4)
    text_file.write("\nttx5 = '%s'" % tt5)
    text_file.write("\nthx0 = '%s'" % th0)
    text_file.write("\nthx1 = '%s'" % th1)
    text_file.write("\nthx2 = '%s'" % th2)
    text_file.write("\nthx3 = '%s'" % th3)
    text_file.write("\nthx4 = '%s'" % th4)
    text_file.write("\nthx5 = '%s'" % th5)
    text_file.close()
    quit()
if data.select('td')[4].text[0:5] == 'High' or data.select('td')[4].text[0:5
    ] == 'Low':
    hl4 = data.select('td')[4].text[0:5]
    hl = 5
elif data.select('td')[18].text[0:5] == 'High' or data.select('td')[18].text[
    0:5] == 'Low':
    hl4 = data.select('td')[15].text[0:5]
    hl5 = data.select('td')[16].text[0:5]
    hl6 = data.select('td')[17].text[0:5]
    tt0 = data.select('td')[4].text[0:5]
    tt1 = data.select('td')[5].text[0:5]
    tt2 = data.select('td')[6].text[0:5]
    tt3 = data.select('td')[7].text[0:5]
    tt4 = data.select('td')[19].text[0:5]
    tt5 = data.select('td')[20].text[0:5]
    tt6 = data.select('td')[21].text[0:5]
    th0 = data.select('td')[8].text[0:4]
    th0 = th0.rstrip()
    th1 = data.select('td')[9].text[0:4]
    th1 = th1.rstrip()
    th2 = data.select('td')[10].text[0:4]
    th2 = th2.rstrip()
    th3 = data.select('td')[11].text[0:4]
    th3 = th3.rstrip()
    th4 = data.select('td')[23].text[0:4]
    th4 = th4.rstrip()
    th5 = data.select('td')[24].text[0:4]
    th5 = th5.rstrip()
    th6 = data.select('td')[25].text[0:4]
    th6 = th6.rstrip()
    text_file = open('%s/tidestore.py' % LOCATION, 'w')
    text_file.write("tl = '%s'" % tl)
    text_file.write("\nhl = '%s'" % hl)
    text_file.write("\nhl0 = '%s'" % hl0)
    text_file.write("\nhl1 = '%s'" % hl1)
    text_file.write("\nhl2 = '%s'" % hl2)
    text_file.write("\nhl3 = '%s'" % hl3)
    text_file.write("\nhl4 = '%s'" % hl4)
    text_file.write("\nhl5 = '%s'" % hl5)
    text_file.write("\nhl6 = '%s'" % hl6)
    text_file.write("\ntt0 = '%s'" % tt0)
    text_file.write("\ntt1 = '%s'" % tt1)
    text_file.write("\ntt2 = '%s'" % tt2)
    text_file.write("\ntt3 = '%s'" % tt3)
    text_file.write("\ntt4 = '%s'" % tt4)
    text_file.write("\ntt5 = '%s'" % tt5)
    text_file.write("\ntt6 = '%s'" % tt6)
    text_file.write("\nth0 = '%s'" % th0)
    text_file.write("\nth1 = '%s'" % th1)
    text_file.write("\nth2 = '%s'" % th2)
    text_file.write("\nth3 = '%s'" % th3)
    text_file.write("\nth4 = '%s'" % th4)
    text_file.write("\nth5 = '%s'" % th5)
    text_file.write("\nth6 = '%s'" % th6)
    text_file.close()
    time.sleep(150)
    text_file = open('%s/tidestorex.py' % LOCATION, 'w')
    text_file.write("tl = '%s'" % tl)
    text_file.write("\nhl = '%s'" % hl)
    text_file.write("\nhlx0 = '%s'" % hl0)
    text_file.write("\nhlx1 = '%s'" % hl1)
    text_file.write("\nhlx2 = '%s'" % hl2)
    text_file.write("\nhlx3 = '%s'" % hl3)
    text_file.write("\nhlx4 = '%s'" % hl4)
    text_file.write("\nhlx5 = '%s'" % hl5)
    text_file.write("\nhlx6 = '%s'" % hl6)
    text_file.write("\nttx0 = '%s'" % tt0)
    text_file.write("\nttx1 = '%s'" % tt1)
    text_file.write("\nttx2 = '%s'" % tt2)
    text_file.write("\nttx3 = '%s'" % tt3)
    text_file.write("\nttx4 = '%s'" % tt4)
    text_file.write("\nttx5 = '%s'" % tt5)
    text_file.write("\nttx6 = '%s'" % tt6)
    text_file.write("\nthx0 = '%s'" % th0)
    text_file.write("\nthx1 = '%s'" % th1)
    text_file.write("\nthx2 = '%s'" % th2)
    text_file.write("\nthx3 = '%s'" % th3)
    text_file.write("\nthx4 = '%s'" % th4)
    text_file.write("\nthx5 = '%s'" % th5)
    text_file.write("\nthx6 = '%s'" % th6)
    text_file.close()
else:
    hl4 = data.select('td')[15].text[0:5]
    hl5 = data.select('td')[16].text[0:5]
    hl6 = data.select('td')[17].text[0:5]
    tt0 = data.select('td')[4].text[0:5]
    tt1 = data.select('td')[5].text[0:5]
    tt2 = data.select('td')[6].text[0:5]
    tt3 = data.select('td')[7].text[0:5]
    tt4 = data.select('td')[18].text[0:5]
    tt5 = data.select('td')[19].text[0:5]
    tt6 = data.select('td')[20].text[0:5]
    th0 = data.select('td')[8].text[0:4]
    th0 = th0.rstrip()
    th1 = data.select('td')[9].text[0:4]
    th1 = th1.rstrip()
    th2 = data.select('td')[10].text[0:4]
    th2 = th2.rstrip()
    th3 = data.select('td')[11].text[0:4]
    th3 = th3.rstrip()
    th4 = data.select('td')[21].text[0:4]
    th4 = th4.rstrip()
    th5 = data.select('td')[22].text[0:4]
    th5 = th5.rstrip()
    th6 = data.select('td')[23].text[0:4]
    th6 = th6.rstrip()
    text_file = open('%s/tidestore.py' % LOCATION, 'w')
    text_file.write("tl = '%s'" % tl)
    text_file.write("\nhl = '%s'" % hl)
    text_file.write("\nhl0 = '%s'" % hl0)
    text_file.write("\nhl1 = '%s'" % hl1)
    text_file.write("\nhl2 = '%s'" % hl2)
    text_file.write("\nhl3 = '%s'" % hl3)
    text_file.write("\nhl4 = '%s'" % hl4)
    text_file.write("\nhl5 = '%s'" % hl5)
    text_file.write("\nhl6 = '%s'" % hl6)
    text_file.write("\ntt0 = '%s'" % tt0)
    text_file.write("\ntt1 = '%s'" % tt1)
    text_file.write("\ntt2 = '%s'" % tt2)
    text_file.write("\ntt3 = '%s'" % tt3)
    text_file.write("\ntt4 = '%s'" % tt4)
    text_file.write("\ntt5 = '%s'" % tt5)
    text_file.write("\ntt6 = '%s'" % tt6)
    text_file.write("\nth0 = '%s'" % th0)
    text_file.write("\nth1 = '%s'" % th1)
    text_file.write("\nth2 = '%s'" % th2)
    text_file.write("\nth3 = '%s'" % th3)
    text_file.write("\nth4 = '%s'" % th4)
    text_file.write("\nth5 = '%s'" % th5)
    text_file.write("\nth6 = '%s'" % th6)
    text_file.close()
    time.sleep(150)
    text_file = open('%s/tidestorex.py' % LOCATION, 'w')
    text_file.write("tl = '%s'" % tl)
    text_file.write("\nhl = '%s'" % hl)
    text_file.write("\nhlx0 = '%s'" % hl0)
    text_file.write("\nhlx1 = '%s'" % hl1)
    text_file.write("\nhlx2 = '%s'" % hl2)
    text_file.write("\nhlx3 = '%s'" % hl3)
    text_file.write("\nhlx4 = '%s'" % hl4)
    text_file.write("\nhlx5 = '%s'" % hl5)
    text_file.write("\nhlx6 = '%s'" % hl6)
    text_file.write("\nttx0 = '%s'" % tt0)
    text_file.write("\nttx1 = '%s'" % tt1)
    text_file.write("\nttx2 = '%s'" % tt2)
    text_file.write("\nttx3 = '%s'" % tt3)
    text_file.write("\nttx4 = '%s'" % tt4)
    text_file.write("\nttx5 = '%s'" % tt5)
    text_file.write("\nttx6 = '%s'" % tt6)
    text_file.write("\nthx0 = '%s'" % th0)
    text_file.write("\nthx1 = '%s'" % th1)
    text_file.write("\nthx2 = '%s'" % th2)
    text_file.write("\nthx3 = '%s'" % th3)
    text_file.write("\nthx4 = '%s'" % th4)
    text_file.write("\nthx5 = '%s'" % th5)
    text_file.write("\nthx6 = '%s'" % th6)
    text_file.close()

<mask token>
raw_html = requests.get(URL).text
data = BeautifulSoup(raw_html, 'html.parser')
tl = data.select('h2')[1]
tl = tl.encode_contents()
tl = tl.rstrip(' <span id="displayDate"></span>')
if data.select('td')[0].text[0:5] == 'High' or data.select('td')[0].text[0:5
    ] == 'Low':
    hl0 = data.select('td')[0].text[0:5]
    hl = 1
else:
    print('ERROR 0')
if data.select('td')[1].text[0:5] == 'High' or data.select('td')[1].text[0:5
    ] == 'Low':
    hl1 = data.select('td')[1].text[0:5]
    hl = 2
else:
    print('ERROR 1')
if data.select('td')[2].text[0:5] == 'High' or data.select('td')[2].text[0:5
    ] == 'Low':
    hl2 = data.select('td')[2].text[0:5]
    hl = 3
else:
    print('ERROR 2')
if data.select('td')[3].text[0:5] == 'High' or data.select('td')[3].text[0:5
    ] == 'Low':
    hl3 = data.select('td')[3].text[0:5]
    hl = 4
elif data.select('td')[15].text[0:5] == 'High' or data.select('td')[15].text[
    0:5] == 'Low':
    hl3 = data.select('td')[12].text[0:5]
    hl4 = data.select('td')[13].text[0:5]
    hl5 = data.select('td')[14].text[0:5]
    tt0 = data.select('td')[3].text[0:5]
    tt1 = data.select('td')[4].text[0:5]
    tt2 = data.select('td')[5].text[0:5]
    tt3 = data.select('td')[16].text[0:5]
    tt4 = data.select('td')[17].text[0:5]
    tt5 = data.select('td')[18].text[0:5]
    th0 = data.select('td')[6].text[0:4]
    th0 = th0.rstrip()
    th1 = data.select('td')[7].text[0:4]
    th1 = th1.rstrip()
    th2 = data.select('td')[8].text[0:4]
    th2 = th2.rstrip()
    th3 = data.select('td')[20].text[0:4]
    th3 = th3.rstrip()
    th4 = data.select('td')[21].text[0:4]
    th4 = th4.rstrip()
    th5 = data.select('td')[22].text[0:4]
    th5 = th5.rstrip()
    text_file = open('%s/tidestore.py' % LOCATION, 'w')
    text_file.write("tl = '%s'" % tl)
    text_file.write("\nhl = '%s'" % hl)
    text_file.write("\nhl0 = '%s'" % hl0)
    text_file.write("\nhl1 = '%s'" % hl1)
    text_file.write("\nhl2 = '%s'" % hl2)
    text_file.write("\nhl3 = '%s'" % hl3)
    text_file.write("\nhl4 = '%s'" % hl4)
    text_file.write("\nhl5 = '%s'" % hl5)
    text_file.write("\ntt0 = '%s'" % tt0)
    text_file.write("\ntt1 = '%s'" % tt1)
    text_file.write("\ntt2 = '%s'" % tt2)
    text_file.write("\ntt3 = '%s'" % tt3)
    text_file.write("\ntt4 = '%s'" % tt4)
    text_file.write("\ntt5 = '%s'" % tt5)
    text_file.write("\nth0 = '%s'" % th0)
    text_file.write("\nth1 = '%s'" % th1)
    text_file.write("\nth2 = '%s'" % th2)
    text_file.write("\nth3 = '%s'" % th3)
    text_file.write("\nth4 = '%s'" % th4)
    text_file.write("\nth5 = '%s'" % th5)
    text_file.close()
    time.sleep(150)
    text_file = open('%s/tidestorex.py' % LOCATION, 'w')
    text_file.write("tl = '%s'" % tl)
    text_file.write("\nhl = '%s'" % hl)
    text_file.write("\nhlx0 = '%s'" % hl0)
    text_file.write("\nhlx1 = '%s'" % hl1)
    text_file.write("\nhlx2 = '%s'" % hl2)
    text_file.write("\nhlx3 = '%s'" % hl3)
    text_file.write("\nhlx4 = '%s'" % hl4)
    text_file.write("\nhlx5 = '%s'" % hl5)
    text_file.write("\nttx0 = '%s'" % tt0)
    text_file.write("\nttx1 = '%s'" % tt1)
    text_file.write("\nttx2 = '%s'" % tt2)
    text_file.write("\nttx3 = '%s'" % tt3)
    text_file.write("\nttx4 = '%s'" % tt4)
    text_file.write("\nttx5 = '%s'" % tt5)
    text_file.write("\nthx0 = '%s'" % th0)
    text_file.write("\nthx1 = '%s'" % th1)
    text_file.write("\nthx2 = '%s'" % th2)
    text_file.write("\nthx3 = '%s'" % th3)
    text_file.write("\nthx4 = '%s'" % th4)
    text_file.write("\nthx5 = '%s'" % th5)
    text_file.close()
    quit()
else:
    hl3 = data.select('td')[12].text[0:5]
    hl4 = data.select('td')[13].text[0:5]
    hl5 = data.select('td')[14].text[0:5]
    tt0 = data.select('td')[3].text[0:5]
    tt1 = data.select('td')[4].text[0:5]
    tt2 = data.select('td')[5].text[0:5]
    tt3 = data.select('td')[15].text[0:5]
    tt4 = data.select('td')[16].text[0:5]
    tt5 = data.select('td')[17].text[0:5]
    th0 = data.select('td')[6].text[0:4]
    th0 = th0.rstrip()
    th1 = data.select('td')[7].text[0:4]
    th1 = th1.rstrip()
    th2 = data.select('td')[8].text[0:4]
    th2 = th2.rstrip()
    th3 = data.select('td')[18].text[0:4]
    th3 = th3.rstrip()
    th4 = data.select('td')[19].text[0:4]
    th4 = th4.rstrip()
    th5 = data.select('td')[20].text[0:4]
    th5 = th5.rstrip()
    text_file = open('%s/tidestore.py' % LOCATION, 'w')
    text_file.write("tl = '%s'" % tl)
    text_file.write("\nhl = '%s'" % hl)
    text_file.write("\nhl0 = '%s'" % hl0)
    text_file.write("\nhl1 = '%s'" % hl1)
    text_file.write("\nhl2 = '%s'" % hl2)
    text_file.write("\nhl3 = '%s'" % hl3)
    text_file.write("\nhl4 = '%s'" % hl4)
    text_file.write("\nhl5 = '%s'" % hl5)
    text_file.write("\ntt0 = '%s'" % tt0)
    text_file.write("\ntt1 = '%s'" % tt1)
    text_file.write("\ntt2 = '%s'" % tt2)
    text_file.write("\ntt3 = '%s'" % tt3)
    text_file.write("\ntt4 = '%s'" % tt4)
    text_file.write("\ntt5 = '%s'" % tt5)
    text_file.write("\nth0 = '%s'" % th0)
    text_file.write("\nth1 = '%s'" % th1)
    text_file.write("\nth2 = '%s'" % th2)
    text_file.write("\nth3 = '%s'" % th3)
    text_file.write("\nth4 = '%s'" % th4)
    text_file.write("\nth5 = '%s'" % th5)
    text_file.close()
    time.sleep(150)
    text_file = open('%s/tidestorex.py' % LOCATION, 'w')
    text_file.write("tl = '%s'" % tl)
    text_file.write("\nhl = '%s'" % hl)
    text_file.write("\nhlx0 = '%s'" % hl0)
    text_file.write("\nhlx1 = '%s'" % hl1)
    text_file.write("\nhlx2 = '%s'" % hl2)
    text_file.write("\nhlx3 = '%s'" % hl3)
    text_file.write("\nhlx4 = '%s'" % hl4)
    text_file.write("\nhlx5 = '%s'" % hl5)
    text_file.write("\nttx0 = '%s'" % tt0)
    text_file.write("\nttx1 = '%s'" % tt1)
    text_file.write("\nttx2 = '%s'" % tt2)
    text_file.write("\nttx3 = '%s'" % tt3)
    text_file.write("\nttx4 = '%s'" % tt4)
    text_file.write("\nttx5 = '%s'" % tt5)
    text_file.write("\nthx0 = '%s'" % th0)
    text_file.write("\nthx1 = '%s'" % th1)
    text_file.write("\nthx2 = '%s'" % th2)
    text_file.write("\nthx3 = '%s'" % th3)
    text_file.write("\nthx4 = '%s'" % th4)
    text_file.write("\nthx5 = '%s'" % th5)
    text_file.close()
    quit()
if data.select('td')[4].text[0:5] == 'High' or data.select('td')[4].text[0:5
    ] == 'Low':
    hl4 = data.select('td')[4].text[0:5]
    hl = 5
elif data.select('td')[18].text[0:5] == 'High' or data.select('td')[18].text[
    0:5] == 'Low':
    hl4 = data.select('td')[15].text[0:5]
    hl5 = data.select('td')[16].text[0:5]
    hl6 = data.select('td')[17].text[0:5]
    tt0 = data.select('td')[4].text[0:5]
    tt1 = data.select('td')[5].text[0:5]
    tt2 = data.select('td')[6].text[0:5]
    tt3 = data.select('td')[7].text[0:5]
    tt4 = data.select('td')[19].text[0:5]
    tt5 = data.select('td')[20].text[0:5]
    tt6 = data.select('td')[21].text[0:5]
    th0 = data.select('td')[8].text[0:4]
    th0 = th0.rstrip()
    th1 = data.select('td')[9].text[0:4]
    th1 = th1.rstrip()
    th2 = data.select('td')[10].text[0:4]
    th2 = th2.rstrip()
    th3 = data.select('td')[11].text[0:4]
    th3 = th3.rstrip()
    th4 = data.select('td')[23].text[0:4]
    th4 = th4.rstrip()
    th5 = data.select('td')[24].text[0:4]
    th5 = th5.rstrip()
    th6 = data.select('td')[25].text[0:4]
    th6 = th6.rstrip()
    text_file = open('%s/tidestore.py' % LOCATION, 'w')
    text_file.write("tl = '%s'" % tl)
    text_file.write("\nhl = '%s'" % hl)
    text_file.write("\nhl0 = '%s'" % hl0)
    text_file.write("\nhl1 = '%s'" % hl1)
    text_file.write("\nhl2 = '%s'" % hl2)
    text_file.write("\nhl3 = '%s'" % hl3)
    text_file.write("\nhl4 = '%s'" % hl4)
    text_file.write("\nhl5 = '%s'" % hl5)
    text_file.write("\nhl6 = '%s'" % hl6)
    text_file.write("\ntt0 = '%s'" % tt0)
    text_file.write("\ntt1 = '%s'" % tt1)
    text_file.write("\ntt2 = '%s'" % tt2)
    text_file.write("\ntt3 = '%s'" % tt3)
    text_file.write("\ntt4 = '%s'" % tt4)
    text_file.write("\ntt5 = '%s'" % tt5)
    text_file.write("\ntt6 = '%s'" % tt6)
    text_file.write("\nth0 = '%s'" % th0)
    text_file.write("\nth1 = '%s'" % th1)
    text_file.write("\nth2 = '%s'" % th2)
    text_file.write("\nth3 = '%s'" % th3)
    text_file.write("\nth4 = '%s'" % th4)
    text_file.write("\nth5 = '%s'" % th5)
    text_file.write("\nth6 = '%s'" % th6)
    text_file.close()
    time.sleep(150)
    text_file = open('%s/tidestorex.py' % LOCATION, 'w')
    text_file.write("tl = '%s'" % tl)
    text_file.write("\nhl = '%s'" % hl)
    text_file.write("\nhlx0 = '%s'" % hl0)
    text_file.write("\nhlx1 = '%s'" % hl1)
    text_file.write("\nhlx2 = '%s'" % hl2)
    text_file.write("\nhlx3 = '%s'" % hl3)
    text_file.write("\nhlx4 = '%s'" % hl4)
    text_file.write("\nhlx5 = '%s'" % hl5)
    text_file.write("\nhlx6 = '%s'" % hl6)
    text_file.write("\nttx0 = '%s'" % tt0)
    text_file.write("\nttx1 = '%s'" % tt1)
    text_file.write("\nttx2 = '%s'" % tt2)
    text_file.write("\nttx3 = '%s'" % tt3)
    text_file.write("\nttx4 = '%s'" % tt4)
    text_file.write("\nttx5 = '%s'" % tt5)
    text_file.write("\nttx6 = '%s'" % tt6)
    text_file.write("\nthx0 = '%s'" % th0)
    text_file.write("\nthx1 = '%s'" % th1)
    text_file.write("\nthx2 = '%s'" % th2)
    text_file.write("\nthx3 = '%s'" % th3)
    text_file.write("\nthx4 = '%s'" % th4)
    text_file.write("\nthx5 = '%s'" % th5)
    text_file.write("\nthx6 = '%s'" % th6)
    text_file.close()
else:
    hl4 = data.select('td')[15].text[0:5]
    hl5 = data.select('td')[16].text[0:5]
    hl6 = data.select('td')[17].text[0:5]
    tt0 = data.select('td')[4].text[0:5]
    tt1 = data.select('td')[5].text[0:5]
    tt2 = data.select('td')[6].text[0:5]
    tt3 = data.select('td')[7].text[0:5]
    tt4 = data.select('td')[18].text[0:5]
    tt5 = data.select('td')[19].text[0:5]
    tt6 = data.select('td')[20].text[0:5]
    th0 = data.select('td')[8].text[0:4]
    th0 = th0.rstrip()
    th1 = data.select('td')[9].text[0:4]
    th1 = th1.rstrip()
    th2 = data.select('td')[10].text[0:4]
    th2 = th2.rstrip()
    th3 = data.select('td')[11].text[0:4]
    th3 = th3.rstrip()
    th4 = data.select('td')[21].text[0:4]
    th4 = th4.rstrip()
    th5 = data.select('td')[22].text[0:4]
    th5 = th5.rstrip()
    th6 = data.select('td')[23].text[0:4]
    th6 = th6.rstrip()
    text_file = open('%s/tidestore.py' % LOCATION, 'w')
    text_file.write("tl = '%s'" % tl)
    text_file.write("\nhl = '%s'" % hl)
    text_file.write("\nhl0 = '%s'" % hl0)
    text_file.write("\nhl1 = '%s'" % hl1)
    text_file.write("\nhl2 = '%s'" % hl2)
    text_file.write("\nhl3 = '%s'" % hl3)
    text_file.write("\nhl4 = '%s'" % hl4)
    text_file.write("\nhl5 = '%s'" % hl5)
    text_file.write("\nhl6 = '%s'" % hl6)
    text_file.write("\ntt0 = '%s'" % tt0)
    text_file.write("\ntt1 = '%s'" % tt1)
    text_file.write("\ntt2 = '%s'" % tt2)
    text_file.write("\ntt3 = '%s'" % tt3)
    text_file.write("\ntt4 = '%s'" % tt4)
    text_file.write("\ntt5 = '%s'" % tt5)
    text_file.write("\ntt6 = '%s'" % tt6)
    text_file.write("\nth0 = '%s'" % th0)
    text_file.write("\nth1 = '%s'" % th1)
    text_file.write("\nth2 = '%s'" % th2)
    text_file.write("\nth3 = '%s'" % th3)
    text_file.write("\nth4 = '%s'" % th4)
    text_file.write("\nth5 = '%s'" % th5)
    text_file.write("\nth6 = '%s'" % th6)
    text_file.close()
    time.sleep(150)
    text_file = open('%s/tidestorex.py' % LOCATION, 'w')
    text_file.write("tl = '%s'" % tl)
    text_file.write("\nhl = '%s'" % hl)
    text_file.write("\nhlx0 = '%s'" % hl0)
    text_file.write("\nhlx1 = '%s'" % hl1)
    text_file.write("\nhlx2 = '%s'" % hl2)
    text_file.write("\nhlx3 = '%s'" % hl3)
    text_file.write("\nhlx4 = '%s'" % hl4)
    text_file.write("\nhlx5 = '%s'" % hl5)
    text_file.write("\nhlx6 = '%s'" % hl6)
    text_file.write("\nttx0 = '%s'" % tt0)
    text_file.write("\nttx1 = '%s'" % tt1)
    text_file.write("\nttx2 = '%s'" % tt2)
    text_file.write("\nttx3 = '%s'" % tt3)
    text_file.write("\nttx4 = '%s'" % tt4)
    text_file.write("\nttx5 = '%s'" % tt5)
    text_file.write("\nttx6 = '%s'" % tt6)
    text_file.write("\nthx0 = '%s'" % th0)
    text_file.write("\nthx1 = '%s'" % th1)
    text_file.write("\nthx2 = '%s'" % th2)
    text_file.write("\nthx3 = '%s'" % th3)
    text_file.write("\nthx4 = '%s'" % th4)
    text_file.write("\nthx5 = '%s'" % th5)
    text_file.write("\nthx6 = '%s'" % th6)
    text_file.close()

import requests
import time
from config import URL
from config import LOCATION
from bs4 import BeautifulSoup
raw_html = requests.get(URL).text
data = BeautifulSoup(raw_html, 'html.parser')
tl = data.select('h2')[1]
tl = tl.encode_contents()
tl = tl.rstrip(' <span id="displayDate"></span>')
if data.select('td')[0].text[0:5] == 'High' or data.select('td')[0].text[0:5
    ] == 'Low':
    hl0 = data.select('td')[0].text[0:5]
    hl = 1
else:
    print('ERROR 0')
if data.select('td')[1].text[0:5] == 'High' or data.select('td')[1].text[0:5
    ] == 'Low':
    hl1 = data.select('td')[1].text[0:5]
    hl = 2
else:
    print('ERROR 1')
if data.select('td')[2].text[0:5] == 'High' or data.select('td')[2].text[0:5
    ] == 'Low':
    hl2 = data.select('td')[2].text[0:5]
    hl = 3
else:
    print('ERROR 2')
if data.select('td')[3].text[0:5] == 'High' or data.select('td')[3].text[0:5
    ] == 'Low':
    hl3 = data.select('td')[3].text[0:5]
    hl = 4
elif data.select('td')[15].text[0:5] == 'High' or data.select('td')[15].text[
    0:5] == 'Low':
    hl3 = data.select('td')[12].text[0:5]
    hl4 = data.select('td')[13].text[0:5]
    hl5 = data.select('td')[14].text[0:5]
    tt0 = data.select('td')[3].text[0:5]
    tt1 = data.select('td')[4].text[0:5]
    tt2 = data.select('td')[5].text[0:5]
    tt3 = data.select('td')[16].text[0:5]
    tt4 = data.select('td')[17].text[0:5]
    tt5 = data.select('td')[18].text[0:5]
    th0 = data.select('td')[6].text[0:4]
    th0 = th0.rstrip()
    th1 = data.select('td')[7].text[0:4]
    th1 = th1.rstrip()
    th2 = data.select('td')[8].text[0:4]
    th2 = th2.rstrip()
    th3 = data.select('td')[20].text[0:4]
    th3 = th3.rstrip()
    th4 = data.select('td')[21].text[0:4]
    th4 = th4.rstrip()
    th5 = data.select('td')[22].text[0:4]
    th5 = th5.rstrip()
    text_file = open('%s/tidestore.py' % LOCATION, 'w')
    text_file.write("tl = '%s'" % tl)
    text_file.write("\nhl = '%s'" % hl)
    text_file.write("\nhl0 = '%s'" % hl0)
    text_file.write("\nhl1 = '%s'" % hl1)
    text_file.write("\nhl2 = '%s'" % hl2)
    text_file.write("\nhl3 = '%s'" % hl3)
    text_file.write("\nhl4 = '%s'" % hl4)
    text_file.write("\nhl5 = '%s'" % hl5)
    text_file.write("\ntt0 = '%s'" % tt0)
    text_file.write("\ntt1 = '%s'" % tt1)
    text_file.write("\ntt2 = '%s'" % tt2)
    text_file.write("\ntt3 = '%s'" % tt3)
    text_file.write("\ntt4 = '%s'" % tt4)
    text_file.write("\ntt5 = '%s'" % tt5)
    text_file.write("\nth0 = '%s'" % th0)
    text_file.write("\nth1 = '%s'" % th1)
    text_file.write("\nth2 = '%s'" % th2)
    text_file.write("\nth3 = '%s'" % th3)
    text_file.write("\nth4 = '%s'" % th4)
    text_file.write("\nth5 = '%s'" % th5)
    text_file.close()
    time.sleep(150)
    text_file = open('%s/tidestorex.py' % LOCATION, 'w')
    text_file.write("tl = '%s'" % tl)
    text_file.write("\nhl = '%s'" % hl)
    text_file.write("\nhlx0 = '%s'" % hl0)
    text_file.write("\nhlx1 = '%s'" % hl1)
    text_file.write("\nhlx2 = '%s'" % hl2)
    text_file.write("\nhlx3 = '%s'" % hl3)
    text_file.write("\nhlx4 = '%s'" % hl4)
    text_file.write("\nhlx5 = '%s'" % hl5)
    text_file.write("\nttx0 = '%s'" % tt0)
    text_file.write("\nttx1 = '%s'" % tt1)
    text_file.write("\nttx2 = '%s'" % tt2)
    text_file.write("\nttx3 = '%s'" % tt3)
    text_file.write("\nttx4 = '%s'" % tt4)
    text_file.write("\nttx5 = '%s'" % tt5)
    text_file.write("\nthx0 = '%s'" % th0)
    text_file.write("\nthx1 = '%s'" % th1)
    text_file.write("\nthx2 = '%s'" % th2)
    text_file.write("\nthx3 = '%s'" % th3)
    text_file.write("\nthx4 = '%s'" % th4)
    text_file.write("\nthx5 = '%s'" % th5)
    text_file.close()
    quit()
else:
    hl3 = data.select('td')[12].text[0:5]
    hl4 = data.select('td')[13].text[0:5]
    hl5 = data.select('td')[14].text[0:5]
    tt0 = data.select('td')[3].text[0:5]
    tt1 = data.select('td')[4].text[0:5]
    tt2 = data.select('td')[5].text[0:5]
    tt3 = data.select('td')[15].text[0:5]
    tt4 = data.select('td')[16].text[0:5]
    tt5 = data.select('td')[17].text[0:5]
    th0 = data.select('td')[6].text[0:4]
    th0 = th0.rstrip()
    th1 = data.select('td')[7].text[0:4]
    th1 = th1.rstrip()
    th2 = data.select('td')[8].text[0:4]
    th2 = th2.rstrip()
    th3 = data.select('td')[18].text[0:4]
    th3 = th3.rstrip()
    th4 = data.select('td')[19].text[0:4]
    th4 = th4.rstrip()
    th5 = data.select('td')[20].text[0:4]
    th5 = th5.rstrip()
    text_file = open('%s/tidestore.py' % LOCATION, 'w')
    text_file.write("tl = '%s'" % tl)
    text_file.write("\nhl = '%s'" % hl)
    text_file.write("\nhl0 = '%s'" % hl0)
    text_file.write("\nhl1 = '%s'" % hl1)
    text_file.write("\nhl2 = '%s'" % hl2)
    text_file.write("\nhl3 = '%s'" % hl3)
    text_file.write("\nhl4 = '%s'" % hl4)
    text_file.write("\nhl5 = '%s'" % hl5)
    text_file.write("\ntt0 = '%s'" % tt0)
    text_file.write("\ntt1 = '%s'" % tt1)
    text_file.write("\ntt2 = '%s'" % tt2)
    text_file.write("\ntt3 = '%s'" % tt3)
    text_file.write("\ntt4 = '%s'" % tt4)
    text_file.write("\ntt5 = '%s'" % tt5)
    text_file.write("\nth0 = '%s'" % th0)
    text_file.write("\nth1 = '%s'" % th1)
    text_file.write("\nth2 = '%s'" % th2)
    text_file.write("\nth3 = '%s'" % th3)
    text_file.write("\nth4 = '%s'" % th4)
    text_file.write("\nth5 = '%s'" % th5)
    text_file.close()
    time.sleep(150)
    text_file = open('%s/tidestorex.py' % LOCATION, 'w')
    text_file.write("tl = '%s'" % tl)
    text_file.write("\nhl = '%s'" % hl)
    text_file.write("\nhlx0 = '%s'" % hl0)
    text_file.write("\nhlx1 = '%s'" % hl1)
    text_file.write("\nhlx2 = '%s'" % hl2)
    text_file.write("\nhlx3 = '%s'" % hl3)
    text_file.write("\nhlx4 = '%s'" % hl4)
    text_file.write("\nhlx5 = '%s'" % hl5)
    text_file.write("\nttx0 = '%s'" % tt0)
    text_file.write("\nttx1 = '%s'" % tt1)
    text_file.write("\nttx2 = '%s'" % tt2)
    text_file.write("\nttx3 = '%s'" % tt3)
    text_file.write("\nttx4 = '%s'" % tt4)
    text_file.write("\nttx5 = '%s'" % tt5)
    text_file.write("\nthx0 = '%s'" % th0)
    text_file.write("\nthx1 = '%s'" % th1)
    text_file.write("\nthx2 = '%s'" % th2)
    text_file.write("\nthx3 = '%s'" % th3)
    text_file.write("\nthx4 = '%s'" % th4)
    text_file.write("\nthx5 = '%s'" % th5)
    text_file.close()
    quit()
if data.select('td')[4].text[0:5] == 'High' or data.select('td')[4].text[0:5
    ] == 'Low':
    hl4 = data.select('td')[4].text[0:5]
    hl = 5
elif data.select('td')[18].text[0:5] == 'High' or data.select('td')[18].text[
    0:5] == 'Low':
    hl4 = data.select('td')[15].text[0:5]
    hl5 = data.select('td')[16].text[0:5]
    hl6 = data.select('td')[17].text[0:5]
    tt0 = data.select('td')[4].text[0:5]
    tt1 = data.select('td')[5].text[0:5]
    tt2 = data.select('td')[6].text[0:5]
    tt3 = data.select('td')[7].text[0:5]
    tt4 = data.select('td')[19].text[0:5]
    tt5 = data.select('td')[20].text[0:5]
    tt6 = data.select('td')[21].text[0:5]
    th0 = data.select('td')[8].text[0:4]
    th0 = th0.rstrip()
    th1 = data.select('td')[9].text[0:4]
    th1 = th1.rstrip()
    th2 = data.select('td')[10].text[0:4]
    th2 = th2.rstrip()
    th3 = data.select('td')[11].text[0:4]
    th3 = th3.rstrip()
    th4 = data.select('td')[23].text[0:4]
    th4 = th4.rstrip()
    th5 = data.select('td')[24].text[0:4]
    th5 = th5.rstrip()
    th6 = data.select('td')[25].text[0:4]
    th6 = th6.rstrip()
    text_file = open('%s/tidestore.py' % LOCATION, 'w')
    text_file.write("tl = '%s'" % tl)
    text_file.write("\nhl = '%s'" % hl)
    text_file.write("\nhl0 = '%s'" % hl0)
    text_file.write("\nhl1 = '%s'" % hl1)
    text_file.write("\nhl2 = '%s'" % hl2)
    text_file.write("\nhl3 = '%s'" % hl3)
    text_file.write("\nhl4 = '%s'" % hl4)
    text_file.write("\nhl5 = '%s'" % hl5)
    text_file.write("\nhl6 = '%s'" % hl6)
    text_file.write("\ntt0 = '%s'" % tt0)
    text_file.write("\ntt1 = '%s'" % tt1)
    text_file.write("\ntt2 = '%s'" % tt2)
    text_file.write("\ntt3 = '%s'" % tt3)
    text_file.write("\ntt4 = '%s'" % tt4)
    text_file.write("\ntt5 = '%s'" % tt5)
    text_file.write("\ntt6 = '%s'" % tt6)
    text_file.write("\nth0 = '%s'" % th0)
    text_file.write("\nth1 = '%s'" % th1)
    text_file.write("\nth2 = '%s'" % th2)
    text_file.write("\nth3 = '%s'" % th3)
    text_file.write("\nth4 = '%s'" % th4)
    text_file.write("\nth5 = '%s'" % th5)
    text_file.write("\nth6 = '%s'" % th6)
    text_file.close()
    time.sleep(150)
    text_file = open('%s/tidestorex.py' % LOCATION, 'w')
    text_file.write("tl = '%s'" % tl)
    text_file.write("\nhl = '%s'" % hl)
    text_file.write("\nhlx0 = '%s'" % hl0)
    text_file.write("\nhlx1 = '%s'" % hl1)
    text_file.write("\nhlx2 = '%s'" % hl2)
    text_file.write("\nhlx3 = '%s'" % hl3)
    text_file.write("\nhlx4 = '%s'" % hl4)
    text_file.write("\nhlx5 = '%s'" % hl5)
    text_file.write("\nhlx6 = '%s'" % hl6)
    text_file.write("\nttx0 = '%s'" % tt0)
    text_file.write("\nttx1 = '%s'" % tt1)
    text_file.write("\nttx2 = '%s'" % tt2)
    text_file.write("\nttx3 = '%s'" % tt3)
    text_file.write("\nttx4 = '%s'" % tt4)
    text_file.write("\nttx5 = '%s'" % tt5)
    text_file.write("\nttx6 = '%s'" % tt6)
    text_file.write("\nthx0 = '%s'" % th0)
    text_file.write("\nthx1 = '%s'" % th1)
    text_file.write("\nthx2 = '%s'" % th2)
    text_file.write("\nthx3 = '%s'" % th3)
    text_file.write("\nthx4 = '%s'" % th4)
    text_file.write("\nthx5 = '%s'" % th5)
    text_file.write("\nthx6 = '%s'" % th6)
    text_file.close()
else:
    hl4 = data.select('td')[15].text[0:5]
    hl5 = data.select('td')[16].text[0:5]
    hl6 = data.select('td')[17].text[0:5]
    tt0 = data.select('td')[4].text[0:5]
    tt1 = data.select('td')[5].text[0:5]
    tt2 = data.select('td')[6].text[0:5]
    tt3 = data.select('td')[7].text[0:5]
    tt4 = data.select('td')[18].text[0:5]
    tt5 = data.select('td')[19].text[0:5]
    tt6 = data.select('td')[20].text[0:5]
    th0 = data.select('td')[8].text[0:4]
    th0 = th0.rstrip()
    th1 = data.select('td')[9].text[0:4]
    th1 = th1.rstrip()
    th2 = data.select('td')[10].text[0:4]
    th2 = th2.rstrip()
    th3 = data.select('td')[11].text[0:4]
    th3 = th3.rstrip()
    th4 = data.select('td')[21].text[0:4]
    th4 = th4.rstrip()
    th5 = data.select('td')[22].text[0:4]
    th5 = th5.rstrip()
    th6 = data.select('td')[23].text[0:4]
    th6 = th6.rstrip()
    text_file = open('%s/tidestore.py' % LOCATION, 'w')
    text_file.write("tl = '%s'" % tl)
    text_file.write("\nhl = '%s'" % hl)
    text_file.write("\nhl0 = '%s'" % hl0)
    text_file.write("\nhl1 = '%s'" % hl1)
    text_file.write("\nhl2 = '%s'" % hl2)
    text_file.write("\nhl3 = '%s'" % hl3)
    text_file.write("\nhl4 = '%s'" % hl4)
    text_file.write("\nhl5 = '%s'" % hl5)
    text_file.write("\nhl6 = '%s'" % hl6)
    text_file.write("\ntt0 = '%s'" % tt0)
    text_file.write("\ntt1 = '%s'" % tt1)
    text_file.write("\ntt2 = '%s'" % tt2)
    text_file.write("\ntt3 = '%s'" % tt3)
    text_file.write("\ntt4 = '%s'" % tt4)
    text_file.write("\ntt5 = '%s'" % tt5)
    text_file.write("\ntt6 = '%s'" % tt6)
    text_file.write("\nth0 = '%s'" % th0)
    text_file.write("\nth1 = '%s'" % th1)
    text_file.write("\nth2 = '%s'" % th2)
    text_file.write("\nth3 = '%s'" % th3)
    text_file.write("\nth4 = '%s'" % th4)
    text_file.write("\nth5 = '%s'" % th5)
    text_file.write("\nth6 = '%s'" % th6)
    text_file.close()
    time.sleep(150)
    text_file = open('%s/tidestorex.py' % LOCATION, 'w')
    text_file.write("tl = '%s'" % tl)
    text_file.write("\nhl = '%s'" % hl)
    text_file.write("\nhlx0 = '%s'" % hl0)
    text_file.write("\nhlx1 = '%s'" % hl1)
    text_file.write("\nhlx2 = '%s'" % hl2)
    text_file.write("\nhlx3 = '%s'" % hl3)
    text_file.write("\nhlx4 = '%s'" % hl4)
    text_file.write("\nhlx5 = '%s'" % hl5)
    text_file.write("\nhlx6 = '%s'" % hl6)
    text_file.write("\nttx0 = '%s'" % tt0)
    text_file.write("\nttx1 = '%s'" % tt1)
    text_file.write("\nttx2 = '%s'" % tt2)
    text_file.write("\nttx3 = '%s'" % tt3)
    text_file.write("\nttx4 = '%s'" % tt4)
    text_file.write("\nttx5 = '%s'" % tt5)
    text_file.write("\nttx6 = '%s'" % tt6)
    text_file.write("\nthx0 = '%s'" % th0)
    text_file.write("\nthx1 = '%s'" % th1)
    text_file.write("\nthx2 = '%s'" % th2)
    text_file.write("\nthx3 = '%s'" % th3)
    text_file.write("\nthx4 = '%s'" % th4)
    text_file.write("\nthx5 = '%s'" % th5)
    text_file.write("\nthx6 = '%s'" % th6)
    text_file.close()

import requests
import time
from config import URL
from config import LOCATION
from bs4 import BeautifulSoup

raw_html = requests.get(URL).text
data = BeautifulSoup(raw_html, 'html.parser')

tl = (data.select('h2')[1])
tl = (tl.encode_contents())
tl = tl.rstrip(' <span id="displayDate"></span>')

if (data.select('td')[0].text[0:5]) == "High" or (data.select('td')[0].text[0:5]) == "Low":
    hl0 = (data.select('td')[0].text[0:5])
    hl = 1
else:
	print ("ERROR 0")

if (data.select('td')[1].text[0:5]) == "High" or (data.select('td')[1].text[0:5]) == "Low":
    hl1 = (data.select('td')[1].text[0:5])
    hl = 2
else:
	print ("ERROR 1")

if (data.select('td')[2].text[0:5]) == "High" or (data.select('td')[2].text[0:5]) == "Low":
    hl2 = (data.select('td')[2].text[0:5])
    hl = 3
else:
	print ("ERROR 2")

if (data.select('td')[3].text[0:5]) == "High" or (data.select('td')[3].text[0:5]) == "Low":
    hl3 = (data.select('td')[3].text[0:5])
    hl = 4
else:
	if (data.select('td')[15].text[0:5]) == "High" or (data.select('td')[15].text[0:5]) == "Low":
		# 3 tide times today and 4 tide times tomorrow
		hl3 = (data.select('td')[12].text[0:5])
		hl4 = (data.select('td')[13].text[0:5])
		hl5 = (data.select('td')[14].text[0:5])
		tt0 = (data.select('td')[3].text[0:5])
		tt1 = (data.select('td')[4].text[0:5])
		tt2 = (data.select('td')[5].text[0:5])
		tt3 = (data.select('td')[16].text[0:5])
		tt4 = (data.select('td')[17].text[0:5])
		tt5 = (data.select('td')[18].text[0:5])
		th0 = (data.select('td')[6].text[0:4])
		th0 = th0.rstrip()
		th1 = (data.select('td')[7].text[0:4])
		th1 = th1.rstrip()
		th2 = (data.select('td')[8].text[0:4])
		th2 = th2.rstrip()
		th3 = (data.select('td')[20].text[0:4])
		th3 = th3.rstrip()
		th4 = (data.select('td')[21].text[0:4])
		th4 = th4.rstrip()
		th5 = (data.select('td')[22].text[0:4])
		th5 = th5.rstrip()
		text_file = open("%s/tidestore.py" % LOCATION, "w")
		text_file.write("tl = '%s'" % tl)
		text_file.write("\nhl = '%s'" % hl)
		text_file.write("\nhl0 = '%s'" % hl0)
		text_file.write("\nhl1 = '%s'" % hl1)
		text_file.write("\nhl2 = '%s'" % hl2)
		text_file.write("\nhl3 = '%s'" % hl3)
		text_file.write("\nhl4 = '%s'" % hl4)
		text_file.write("\nhl5 = '%s'" % hl5)
		text_file.write("\ntt0 = '%s'" % tt0)
		text_file.write("\ntt1 = '%s'" % tt1)
		text_file.write("\ntt2 = '%s'" % tt2)
		text_file.write("\ntt3 = '%s'" % tt3)
		text_file.write("\ntt4 = '%s'" % tt4)
		text_file.write("\ntt5 = '%s'" % tt5)
		text_file.write("\nth0 = '%s'" % th0)
		text_file.write("\nth1 = '%s'" % th1)
		text_file.write("\nth2 = '%s'" % th2)
		text_file.write("\nth3 = '%s'" % th3)
		text_file.write("\nth4 = '%s'" % th4)
		text_file.write("\nth5 = '%s'" % th5)
		text_file.close()
		time.sleep(150)
		text_file = open("%s/tidestorex.py" % LOCATION, "w")
		text_file.write("tl = '%s'" % tl)
		text_file.write("\nhl = '%s'" % hl)
		text_file.write("\nhlx0 = '%s'" % hl0)
		text_file.write("\nhlx1 = '%s'" % hl1)
		text_file.write("\nhlx2 = '%s'" % hl2)
		text_file.write("\nhlx3 = '%s'" % hl3)
		text_file.write("\nhlx4 = '%s'" % hl4)
		text_file.write("\nhlx5 = '%s'" % hl5)
		text_file.write("\nttx0 = '%s'" % tt0)
		text_file.write("\nttx1 = '%s'" % tt1)
		text_file.write("\nttx2 = '%s'" % tt2)
		text_file.write("\nttx3 = '%s'" % tt3)
		text_file.write("\nttx4 = '%s'" % tt4)
		text_file.write("\nttx5 = '%s'" % tt5)
		text_file.write("\nthx0 = '%s'" % th0)
		text_file.write("\nthx1 = '%s'" % th1)
		text_file.write("\nthx2 = '%s'" % th2)
		text_file.write("\nthx3 = '%s'" % th3)
		text_file.write("\nthx4 = '%s'" % th4)
		text_file.write("\nthx5 = '%s'" % th5)
		text_file.close()
		quit()
	else:
		# 3 tide times today and 3 tide times tomorrow
		hl3 = (data.select('td')[12].text[0:5])
		hl4 = (data.select('td')[13].text[0:5])
		hl5 = (data.select('td')[14].text[0:5])
		tt0 = (data.select('td')[3].text[0:5])
		tt1 = (data.select('td')[4].text[0:5])
		tt2 = (data.select('td')[5].text[0:5])
		tt3 = (data.select('td')[15].text[0:5])
		tt4 = (data.select('td')[16].text[0:5])
		tt5 = (data.select('td')[17].text[0:5])
		th0 = (data.select('td')[6].text[0:4])
		th0 = th0.rstrip()
		th1 = (data.select('td')[7].text[0:4])
		th1 = th1.rstrip()
		th2 = (data.select('td')[8].text[0:4])
		th2 = th2.rstrip()
		th3 = (data.select('td')[18].text[0:4])
		th3 = th3.rstrip()
		th4 = (data.select('td')[19].text[0:4])
		th4 = th4.rstrip()
		th5 = (data.select('td')[20].text[0:4])
		th5 = th5.rstrip()
		text_file = open("%s/tidestore.py" % LOCATION, "w")
		text_file.write("tl = '%s'" % tl)
		text_file.write("\nhl = '%s'" % hl)
		text_file.write("\nhl0 = '%s'" % hl0)
		text_file.write("\nhl1 = '%s'" % hl1)
		text_file.write("\nhl2 = '%s'" % hl2)
		text_file.write("\nhl3 = '%s'" % hl3)
		text_file.write("\nhl4 = '%s'" % hl4)
		text_file.write("\nhl5 = '%s'" % hl5)
		text_file.write("\ntt0 = '%s'" % tt0)
		text_file.write("\ntt1 = '%s'" % tt1)
		text_file.write("\ntt2 = '%s'" % tt2)
		text_file.write("\ntt3 = '%s'" % tt3)
		text_file.write("\ntt4 = '%s'" % tt4)
		text_file.write("\ntt5 = '%s'" % tt5)
		text_file.write("\nth0 = '%s'" % th0)
		text_file.write("\nth1 = '%s'" % th1)
		text_file.write("\nth2 = '%s'" % th2)
		text_file.write("\nth3 = '%s'" % th3)
		text_file.write("\nth4 = '%s'" % th4)
		text_file.write("\nth5 = '%s'" % th5)
		text_file.close()
		time.sleep(150)
		text_file = open("%s/tidestorex.py" % LOCATION, "w")
		text_file.write("tl = '%s'" % tl)
		text_file.write("\nhl = '%s'" % hl)
		text_file.write("\nhlx0 = '%s'" % hl0)
		text_file.write("\nhlx1 = '%s'" % hl1)
		text_file.write("\nhlx2 = '%s'" % hl2)
		text_file.write("\nhlx3 = '%s'" % hl3)
		text_file.write("\nhlx4 = '%s'" % hl4)
		text_file.write("\nhlx5 = '%s'" % hl5)
		text_file.write("\nttx0 = '%s'" % tt0)
		text_file.write("\nttx1 = '%s'" % tt1)
		text_file.write("\nttx2 = '%s'" % tt2)
		text_file.write("\nttx3 = '%s'" % tt3)
		text_file.write("\nttx4 = '%s'" % tt4)
		text_file.write("\nttx5 = '%s'" % tt5)
		text_file.write("\nthx0 = '%s'" % th0)
		text_file.write("\nthx1 = '%s'" % th1)
		text_file.write("\nthx2 = '%s'" % th2)
		text_file.write("\nthx3 = '%s'" % th3)
		text_file.write("\nthx4 = '%s'" % th4)
		text_file.write("\nthx5 = '%s'" % th5)
		text_file.close()
		quit()
if (data.select('td')[4].text[0:5]) == "High" or (data.select('td')[4].text[0:5]) == "Low":
    hl4 = (data.select('td')[4].text[0:5])
    hl = 5
else:
	if (data.select('td')[18].text[0:5]) == "High" or (data.select('td')[18].text[0:5]) == "Low":
		# 4 tide times today and 4 tide times tomorrow
		hl4 = (data.select('td')[15].text[0:5])
		hl5 = (data.select('td')[16].text[0:5])
		hl6 = (data.select('td')[17].text[0:5])
		tt0 = (data.select('td')[4].text[0:5])
		tt1 = (data.select('td')[5].text[0:5])
		tt2 = (data.select('td')[6].text[0:5])
		tt3 = (data.select('td')[7].text[0:5])
		tt4 = (data.select('td')[19].text[0:5])
		tt5 = (data.select('td')[20].text[0:5])
		tt6 = (data.select('td')[21].text[0:5])
		th0 = (data.select('td')[8].text[0:4])
		th0 = th0.rstrip()
		th1 = (data.select('td')[9].text[0:4])
		th1 = th1.rstrip()
		th2 = (data.select('td')[10].text[0:4])
		th2 = th2.rstrip()
		th3 = (data.select('td')[11].text[0:4])
		th3 = th3.rstrip()
		th4 = (data.select('td')[23].text[0:4])
		th4 = th4.rstrip()
		th5 = (data.select('td')[24].text[0:4])
		th5 = th5.rstrip()
		th6 = (data.select('td')[25].text[0:4])
		th6 = th6.rstrip()
		text_file = open("%s/tidestore.py" % LOCATION, "w")
		text_file.write("tl = '%s'" % tl)
		text_file.write("\nhl = '%s'" % hl)
		text_file.write("\nhl0 = '%s'" % hl0)
		text_file.write("\nhl1 = '%s'" % hl1)
		text_file.write("\nhl2 = '%s'" % hl2)
		text_file.write("\nhl3 = '%s'" % hl3)
		text_file.write("\nhl4 = '%s'" % hl4)
		text_file.write("\nhl5 = '%s'" % hl5)
		text_file.write("\nhl6 = '%s'" % hl6)
		text_file.write("\ntt0 = '%s'" % tt0)
		text_file.write("\ntt1 = '%s'" % tt1)
		text_file.write("\ntt2 = '%s'" % tt2)
		text_file.write("\ntt3 = '%s'" % tt3)
		text_file.write("\ntt4 = '%s'" % tt4)
		text_file.write("\ntt5 = '%s'" % tt5)
		text_file.write("\ntt6 = '%s'" % tt6)
		text_file.write("\nth0 = '%s'" % th0)
		text_file.write("\nth1 = '%s'" % th1)
		text_file.write("\nth2 = '%s'" % th2)
		text_file.write("\nth3 = '%s'" % th3)
		text_file.write("\nth4 = '%s'" % th4)
		text_file.write("\nth5 = '%s'" % th5)
		text_file.write("\nth6 = '%s'" % th6)
		text_file.close()
		time.sleep(150)
		text_file = open("%s/tidestorex.py" % LOCATION, "w")
		text_file.write("tl = '%s'" % tl)
		text_file.write("\nhl = '%s'" % hl)
		text_file.write("\nhlx0 = '%s'" % hl0)
		text_file.write("\nhlx1 = '%s'" % hl1)
		text_file.write("\nhlx2 = '%s'" % hl2)
		text_file.write("\nhlx3 = '%s'" % hl3)
		text_file.write("\nhlx4 = '%s'" % hl4)
		text_file.write("\nhlx5 = '%s'" % hl5)
		text_file.write("\nhlx6 = '%s'" % hl6)
		text_file.write("\nttx0 = '%s'" % tt0)
		text_file.write("\nttx1 = '%s'" % tt1)
		text_file.write("\nttx2 = '%s'" % tt2)
		text_file.write("\nttx3 = '%s'" % tt3)
		text_file.write("\nttx4 = '%s'" % tt4)
		text_file.write("\nttx5 = '%s'" % tt5)
		text_file.write("\nttx6 = '%s'" % tt6)
		text_file.write("\nthx0 = '%s'" % th0)
		text_file.write("\nthx1 = '%s'" % th1)
		text_file.write("\nthx2 = '%s'" % th2)
		text_file.write("\nthx3 = '%s'" % th3)
		text_file.write("\nthx4 = '%s'" % th4)
		text_file.write("\nthx5 = '%s'" % th5)
		text_file.write("\nthx6 = '%s'" % th6)
		text_file.close()
	else:
		# 4 tide times today and 3 tide times tomorrow
		hl4 = (data.select('td')[15].text[0:5])
		hl5 = (data.select('td')[16].text[0:5])
		hl6 = (data.select('td')[17].text[0:5])
		tt0 = (data.select('td')[4].text[0:5])
		tt1 = (data.select('td')[5].text[0:5])
		tt2 = (data.select('td')[6].text[0:5])
		tt3 = (data.select('td')[7].text[0:5])
		tt4 = (data.select('td')[18].text[0:5])
		tt5 = (data.select('td')[19].text[0:5])
		tt6 = (data.select('td')[20].text[0:5])
		th0 = (data.select('td')[8].text[0:4])
		th0 = th0.rstrip()
		th1 = (data.select('td')[9].text[0:4])
		th1 = th1.rstrip()
		th2 = (data.select('td')[10].text[0:4])
		th2 = th2.rstrip()
		th3 = (data.select('td')[11].text[0:4])
		th3 = th3.rstrip()
		th4 = (data.select('td')[21].text[0:4])
		th4 = th4.rstrip()
		th5 = (data.select('td')[22].text[0:4])
		th5 = th5.rstrip()
		th6 = (data.select('td')[23].text[0:4])
		th6 = th6.rstrip()
		text_file = open("%s/tidestore.py" % LOCATION, "w")
		text_file.write("tl = '%s'" % tl)
		text_file.write("\nhl = '%s'" % hl)
		text_file.write("\nhl0 = '%s'" % hl0)
		text_file.write("\nhl1 = '%s'" % hl1)
		text_file.write("\nhl2 = '%s'" % hl2)
		text_file.write("\nhl3 = '%s'" % hl3)
		text_file.write("\nhl4 = '%s'" % hl4)
		text_file.write("\nhl5 = '%s'" % hl5)
		text_file.write("\nhl6 = '%s'" % hl6)
		text_file.write("\ntt0 = '%s'" % tt0)
		text_file.write("\ntt1 = '%s'" % tt1)
		text_file.write("\ntt2 = '%s'" % tt2)
		text_file.write("\ntt3 = '%s'" % tt3)
		text_file.write("\ntt4 = '%s'" % tt4)
		text_file.write("\ntt5 = '%s'" % tt5)
		text_file.write("\ntt6 = '%s'" % tt6)
		text_file.write("\nth0 = '%s'" % th0)
		text_file.write("\nth1 = '%s'" % th1)
		text_file.write("\nth2 = '%s'" % th2)
		text_file.write("\nth3 = '%s'" % th3)
		text_file.write("\nth4 = '%s'" % th4)
		text_file.write("\nth5 = '%s'" % th5)
		text_file.write("\nth6 = '%s'" % th6)
		text_file.close()
		time.sleep(150)
		text_file = open("%s/tidestorex.py" % LOCATION, "w")
		text_file.write("tl = '%s'" % tl)
		text_file.write("\nhl = '%s'" % hl)
		text_file.write("\nhlx0 = '%s'" % hl0)
		text_file.write("\nhlx1 = '%s'" % hl1)
		text_file.write("\nhlx2 = '%s'" % hl2)
		text_file.write("\nhlx3 = '%s'" % hl3)
		text_file.write("\nhlx4 = '%s'" % hl4)
		text_file.write("\nhlx5 = '%s'" % hl5)
		text_file.write("\nhlx6 = '%s'" % hl6)
		text_file.write("\nttx0 = '%s'" % tt0)
		text_file.write("\nttx1 = '%s'" % tt1)
		text_file.write("\nttx2 = '%s'" % tt2)
		text_file.write("\nttx3 = '%s'" % tt3)
		text_file.write("\nttx4 = '%s'" % tt4)
		text_file.write("\nttx5 = '%s'" % tt5)
		text_file.write("\nttx6 = '%s'" % tt6)
		text_file.write("\nthx0 = '%s'" % th0)
		text_file.write("\nthx1 = '%s'" % th1)
		text_file.write("\nthx2 = '%s'" % th2)
		text_file.write("\nthx3 = '%s'" % th3)
		text_file.write("\nthx4 = '%s'" % th4)
		text_file.write("\nthx5 = '%s'" % th5)
		text_file.write("\nthx6 = '%s'" % th6)
		text_file.close()
