Nov-12-2019, 10:20 AM
Hello all;
I'm would like to ask some advices to the python community concerning a script I'm trying to develop.
In fact, I'm living near a lake in Italy, and from time to time the water level is very close from my house, so I'm looking a way to pick-up a value from a webpage dealing with the lake level, and sending me notification when this level reach a high value.
The webpage giving the value is this one : https:www.astrogeo.va.it/idro/idro.php
the value I want to retrieve is the one after "Stazione di Leggiuno", by example today : 194.12, as indicated on the website.
Using examples found on the web, I used Request and beautifulsoup to retrieve this info :
I'was thinking that the value I wanted to extract should be just after the mark "Stazione di Leggiuno", but instead, I got this "+data.legb.livello", and cannor recover the result displayed on the webpage (in this case 194.12).
Anyone of the python community has been face to this problem ? how is it possible to retrieve the numerical value , if possible ?
Many thanks in advance for your help !
I'm would like to ask some advices to the python community concerning a script I'm trying to develop.
In fact, I'm living near a lake in Italy, and from time to time the water level is very close from my house, so I'm looking a way to pick-up a value from a webpage dealing with the lake level, and sending me notification when this level reach a high value.
The webpage giving the value is this one : https:www.astrogeo.va.it/idro/idro.php
the value I want to retrieve is the one after "Stazione di Leggiuno", by example today : 194.12, as indicated on the website.
Using examples found on the web, I used Request and beautifulsoup to retrieve this info :
#!/usr/bin/python import requests from bs4 import BeautifulSoup # using the requests module, we use the "get" funtion result = requests.get("https:www.astrogeo.va.it/idro/idro.php") print(result.status_code) # let us store the page content of the website # from requests to a variable src = result.content print(src)so, I receive the 'result' on my screen, with the data I want to import :
Quote:document.getElementById("Livello').InnerHTML="<strong>Stazione di Leggiuno: "+data.legb.livello[ data.legb.livello.lenght-1]+"<font color='#417 FDA'>
I'was thinking that the value I wanted to extract should be just after the mark "Stazione di Leggiuno", but instead, I got this "+data.legb.livello", and cannor recover the result displayed on the webpage (in this case 194.12).
Anyone of the python community has been face to this problem ? how is it possible to retrieve the numerical value , if possible ?
Many thanks in advance for your help !