Skip to content
Snippets Groups Projects
Commit 1ad43aa0 authored by Anton Sarukhanov's avatar Anton Sarukhanov
Browse files

Fix refresh, autosubmit select, handle errors.

parent c2893bea
No related branches found
No related tags found
No related merge requests found
......@@ -15,11 +15,14 @@ def scrape(results_url):
event_urls = results_tree.xpath(
'//div[@id="schedule"]/table/tr/td/a[text()="View"]/@href')
except IndexError:
return "No event schedule found"
tournament_name = results_tree.xpath(
'//span[@class="tournName"]/text()')[0]
tournament_details = results_tree.xpath(
'//span[@class="tournDetails"]/text()')[0]
return "No event schedule found."
try:
tournament_name = results_tree.xpath(
'//span[@class="tournName"]/text()')[0]
tournament_details = results_tree.xpath(
'//span[@class="tournDetails"]/text()')[0]
except IndexError:
return "Tournament info not found."
events = []
for event_url in event_urls:
if not urlparse(event_url).netloc:
......
......@@ -10,7 +10,7 @@
<p>
<form action="{{ url_for('live') }}" method="get">
<label>Live Results URL: &nbsp;
<select name="results_url">
<select name="results_url" onchange="this.form.submit()">
<option value="" selected disabled>-- Select One --</option>
<optgroup label="Escrime Management">
<option value="http://escrimeresults.com/tournaments/NCAA.html">NCAA</option>
......
{% extends "base.html" %}
{% block extra_head %}
<meta http-equiv="refresh" content="60; URL={{ url_for('live') }}">
<meta http-equiv="refresh" content="60; URL={{ request.url }}">
{% endblock extra_head %}
{% block content %}
<header>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment