dvaz commited on
Commit
53da065
·
1 Parent(s): 7cd6c18

Upload 16_Pricerunner.py

Browse files
Files changed (1) hide show
  1. pages/16_Pricerunner.py +46 -0
pages/16_Pricerunner.py ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import requests
2
+ import streamlit as st
3
+
4
+
5
+
6
+ st.set_page_config('Price',menu_items={'About': "This is an *extremely* cool app!"})
7
+
8
+
9
+ menu=['Find price']
10
+ ch=st.sidebar.selectbox('Menu',menu)
11
+
12
+
13
+ if 'Find price' in ch:
14
+ with st.container():
15
+ st.title('Search for price')
16
+ ti=st.text_input('Search')
17
+ if len(ti)>0:
18
+ r=requests.get('https://www.pricerunner.dk/public/search/v3/dk?q='+ti)
19
+ x=r.json()
20
+ for i in x['products']:
21
+ with st.container():
22
+ lc , rc = st.columns(2)
23
+ with lc:
24
+ add='https:/www.pricerunner.dk'+i['image']['path']
25
+ st.image(add)
26
+ with rc:
27
+ id=i['id']
28
+ comp=i['url']
29
+ des=i['description']
30
+ low=i['lowestPrice']['amount']
31
+ name=i['name']
32
+
33
+
34
+ r2=requests.get('https://www.pricerunner.dk/public/productlistings/v3/pl/2-'+id+'/dk/filter')
35
+ x2=r2.json()
36
+ x3=x2['filteredOfferList']['merchantOffers'][0]['offers'][0]['url']
37
+
38
+
39
+ st.header(name)
40
+ st.write(des)
41
+ st.success(low+' DKK')
42
+ st.write('Link to buy:')
43
+ st.write('https://www.pricerunner.dk'+ x3)
44
+
45
+ st.write('---')
46
+