-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.py
32 lines (19 loc) · 899 Bytes
/
app.py
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
import requests
from flask import Flask
from flask_restful import Resource, Api
import re
app = Flask(__name__)
api = Api(app)
class Price(Resource):
def get(self):
result = requests.get('http://www.hl.co.uk/shares/shares-search-results/x/xbt-provider-ab-bitcoin-tracker-one',verify=False).content
search = re.search('<span class="bid price-divide" >(.*)</span>', result)
btc = search.group(1).replace(" SEK","")
result = requests.get('http://www.hl.co.uk/shares/shares-search-results/x/xbt-provider-ab-ethereum-tracker-eur',verify=False).content
search = re.search('<span class="bid price-divide" >(.*)</span>', result)
eth = search.group(1).replace("€","")
data = { 'eth':eth, 'btc':btc }
return data
api.add_resource(Price, '/price')
if __name__ == '__main__':
app.run(debug=True, host='0.0.0.0', port=80)