-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathscrapeAPI.py
More file actions
70 lines (55 loc) · 1.64 KB
/
Copy pathscrapeAPI.py
File metadata and controls
70 lines (55 loc) · 1.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
from flask import Blueprint
from flask import render_template
import webscraping
def constructBlueprint(announcer, instance, abstractDriver):
scrapeApi = Blueprint("scrapeApi", __name__)
@scrapeApi.route("/", methods=["GET", "POST"])
def scrape():
webscraping.scrape_meteoschweiz(
abstractDriver,
instance,
announcer
)
webscraping.scrape_idaweb(
abstractDriver,
instance,
announcer
)
return "Finished scrapping"
@scrapeApi.route("/meteoschweiz", methods=["GET"])
def scrapeMeteoschweizGet():
""" Return meteosuisse page
Returns:
html: Renders html template
"""
return render_template(
"stream.html",
streamUrl="/admin/stream/meteoschweiz"
)
@scrapeApi.route("/meteoschweiz", methods=["POST"])
def scrapeMeteoschweizPost():
_ = webscraping.scrape_meteoschweiz(
abstractDriver,
instance,
announcer
)
return "Finished scrapping meteoschweiz"
@scrapeApi.route("/idaweb", methods=["GET"])
def scrapeIdawebGet():
""" Return idaweb page
Returns:
html: Renders html template
"""
return render_template(
"stream.html",
streamUrl="/admin/stream/idaweb"
)
@scrapeApi.route("/idaweb", methods=["POST"])
def scrapeIdawebPost():
_ = webscraping.scrape_idaweb(
abstractDriver,
instance,
announcer
)
return "Finished scrapping idaweb"
return scrapeApi