Ambient Weather Parser Error
I am trying to create a custom weather parser to work with ambient weathers api. I checked every example and followed the syntax for sending the request:
2018-06-20 02:36:01,084 - DEBUG - rmParser:115 - Parser 'Ambient Weather': downloading from https://api.ambientweather.net/v1/devices/redacted?apiKey=redacted&applicationKey=redacted&limit=288 2018-06-20 02:36:01,421 - ERROR - rmParser:133 - *** Error in parser 'Ambient Weather' while downloading data from https://api.ambientweather.net/v1/devices/redacted?apiKey=redacted&applicationKey=redacted&limit=288, error:
The log shows 'error:' but no error after it. If i copy the url and paste it in to my browser, i get the correct response so the URL is correct, is there anything else I should be looking at?
-
Hi Zach,
We're thrilled that some one looks at Ambient Weather integration !
First you could, instead of return json.loads() print the output to console with log.info(json.loads(d.read())
Secondly enclose the entire block in a try/except like this:
try:
d = self.openURL(url)
if d isNone:
return
log.info(json.loads(d.read()))
except Exception, e:
log.error(e)I seen that the actual error isn't shown on your output maybe this will give more information about what's going on. -
That is actually the exact code I currently have, I removed the log to simplify it. It doesn't get to the log line because it is throwing the error at self.openurl and moved to the exception block.
I also tried with urllib2 but still got an exception with no error message. I'm not sure what else to try.
-
Can you try a simple HTTP not HTTPS request to check if your platform doesn't have some issues with SSL ?
Maybe use this url: http://demo.labs.rainmachine.com/js/highcharts-custom.js to check if you get the data ?
Then try HTTPS with this url: https://demo.labs.rainmachine.com:18080/api/4/apiVer
-
I wrote a script to call the URL and ran it on my computer which is running python 3 and it returned data but couldn't parse it to a json object. Then I changed it to use the requests library to make the call and parse the json and it worked great.
It seems like the python version on the rainmachine unit is 2.x, is that going to change in the near future? Also, would it be possible to make the requests library available for use?
-
I am having the EXACT same problem - Ambient Weather - working in pyCharm, URLs work in Browser, but on the RainMachine I get the exact same error of:
- 2018-06-22 16:02:21,144 - ERROR - user-aw-parser:271 - *** Error in parser 'Ambient Weather Parser v1.0.004' while downloading data from https://api.ambientweather.net/v1/devices?applicationKey=<long key>&apiKey=<long key>, error:
- where <long key> are my API and APP Keys - each 64 characters long.
I also get nothing after the "error:".
I was wondering if the length of the URL is maybe causing a problem?
-
Additional Information: I added code to "catch" URLError and got the following additional information on the error:
-
... reason: [Errno 1] _ssl.c:510: error:14077438:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert internal error
Looks like SSL related but I have not idea what to do about this.
-
-
I tested with a newer version of python (2.7.14) and urllib2 and still doesn't work:
>>> j = urllib2.urlopen(u)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/urllib2.py", line 154, in urlopen
File "/usr/lib/python2.7/urllib2.py", line 429, in open
File "/usr/lib/python2.7/urllib2.py", line 447, in _open
File "/usr/lib/python2.7/urllib2.py", line 407, in _call_chain
File "/usr/lib/python2.7/urllib2.py", line 1241, in https_open
File "/usr/lib/python2.7/urllib2.py", line 1198, in do_open
urllib2.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] unknown error (_ssl.c:661)>We'll check what requests lib does better vs urllib2 regarding this https calls.
-
I am having the exact same problem. I've written a parser for an Ambient Weather PWS in python (because Weatherunderground doesn't do free APIs anymore ... grr). When I test the script from my computer it works perfectly. When I upload it to the Rain Machine, I am getting the same error Jens identified above.
I traced that error to what I thought was an incompatibility with the version of Python that you have on the HD-12 currently. For Ambient Weather, the API call to api.ambientweather.net must be using https, and this site works only with SNI (Server Name Indication) support. I was able to SSH into the HD-12 and saw that you currently have Python 2.7.8 on the HD-12 right now, and SNI is not supported in Python until 2.7.9 or later. So I was thinking that an upgrade to the version of Python would help, but it looks like you already tried that above.
I would still upgrade the Python version in the HD-12, but is there any word on the upcoming SSL update so that I (and others) can get the Ambient Weather parsers working?
-
FYI. A new AmbientWeather parse was posted here: https://support.rainmachine.com/hc/en-us/community/posts/360029128293-Ambient-Weather-Parser I tried it. It appears to be working.
Please sign in to leave a comment.
Comments
16 comments