You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Aug 4, 2020. It is now read-only.
client = xively.Client(key)
now = datetime.now()
prelev = urlText[35]
lev = prelev.replace(",",".")
if lev > 0:
datastream = xively.Datastream(id="livello", current_value= lev)
client.put('/v2/feeds/'+feedid, data={'datastreams': [datastream]})
print "%s %s" % (now, lev)
The script app.py is parsing water_level data from a website and posting value in xively.
I'm using Heroku platform who run "python app.py" every hour thanks to Heroku Scheduler. (using venv , with git+git://github.com/xively/xively-python.git in the requirements.txt)
The data seem to be sent fine to xively but, every now and then, on a period of 1 week, it shows strange negative values like -999, as you can see from the graph at https://xively.com/feeds/117061/
Why this negative values are posted? They don't seems to come from the website parsing. (i mean, water_level cannot go under zero). How can i solve the issue?
Thanks.
The text was updated successfully, but these errors were encountered:
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Hello. I'm a newbie. So i just copy from an example script to make a feed in xively.
!/usr/bin/env python
import xively
import time
from datetime import datetime
import HTMLParser
import urllib
key= 'hidden'
feedid = '117061'
urlText = []
class parseText(HTMLParser.HTMLParser):
def handle_data(self,data):
if data != '\n' and data != '\r\n' and data != '\r\n\t':
urlText.append(data)
lParser = parseText()
lParser.feed(urllib.urlopen('http://www.idrografico.roma.it/ASP.NET/tempo_reale_ripetta.aspx').read())
lParser.close()
client = xively.Client(key)
now = datetime.now()
prelev = urlText[35]
lev = prelev.replace(",",".")
if lev > 0:
datastream = xively.Datastream(id="livello", current_value= lev)
client.put('/v2/feeds/'+feedid, data={'datastreams': [datastream]})
print "%s %s" % (now, lev)
The script app.py is parsing water_level data from a website and posting value in xively.
I'm using Heroku platform who run "python app.py" every hour thanks to Heroku Scheduler. (using venv , with git+git://github.com/xively/xively-python.git in the requirements.txt)
The data seem to be sent fine to xively but, every now and then, on a period of 1 week, it shows strange negative values like -999, as you can see from the graph at https://xively.com/feeds/117061/
Why this negative values are posted? They don't seems to come from the website parsing. (i mean, water_level cannot go under zero). How can i solve the issue?
Thanks.
The text was updated successfully, but these errors were encountered: