jbuitt / nwws-python-client

Python client for downloading products from NOAA Weather Wire
https://github.com/jbuitt/nwws-python-client
MIT License
10 stars 10 forks source link

Not-Authorized | Error Reading From XML stream #2

Closed williammuff closed 3 years ago

williammuff commented 4 years ago

I'm able to authenticate via Pidgin and connect to the conference chat, but when I run i get an "not-authorized" error followed by a "Error reading XML Stream", which i assume is because i'm not authenticated.... Curious if this is still being used.

I'm getting this error: root@muffserver:/var/www/wwwshare/wx/nwws-python-client# python nwws2.py config.json INFO Negotiating TLS INFO Using SSL version: TLSv1 INFO Authentication failed: not-authorized INFO Authentication failed: not-authorized INFO Authentication failed: not-authorized ERROR Error reading from XML stream. INFO Waiting for </stream:stream> from server INFO Negotiating TLS INFO Using SSL version: TLSv1 ^CCaught Ctrl+C. Exiting. INFO Waiting for </stream:stream> from server

I should note i'm in way over my head as i have no clue how xmpp works.

image

jbuitt commented 4 years ago

Hi William,

Are you connected to Pidgin at the same time that you're trying to connect with the nwws-python-client ? The National Weather Service doesn't allow multiple simultaneous connections using the same credentials, that is the error you would get if you are already connected.

Jim

williammuff commented 4 years ago

Yea I had made sure i closed down Pidgin. Curious if you are still using this? I was reading something about SSL certs being V3 in the sleekxmpp. I'm not sure what "Use old-style SSL" does within Pidgin.

bambryan commented 4 years ago

I would be nice to get this fixed. Really could use this script to have a push ingest instead of a pull from api.weather.gov

jbuitt commented 4 years ago

I don't think it's an issue with the Python script, as I am currently using this repo in a couple different places, and I'm not having this authentication problem. My environment is Ubuntu 18.04 LTS with SleekXMPP installed from the Ubuntu repos. (v1.3.3-3)

I do know that there were authentication issues with the NWWS starting back in December, and that the NWS made a change on Jan 14th to address those issues. If you're still getting "not authorized" after the 14th, then there may be something wrong with your credentials. I would request new credentials at https://www.weather.gov/nwws/. (Click on the NWWS-OI tab)

Jim

bambryan commented 4 years ago

What version of asn1 and asn1_modules are you using? Those seem to matter also.

jbuitt commented 4 years ago

python-pyasn1 - 0.4.2-3 python-pyasn1-modules - 0.2.1-0.2

Note that I will eventually be porting this to Python 3, since Python 2 is now EOL.

zentec commented 4 years ago

I suspect this issue is related to what came here to report.

With Python 3.7, the connection process fails on SSL cert negotiation. It goes no further, and TCP connections are continually re-established, hinting at SSL failures. Seeing that nwws-oi specifically calls out to use old-style SSL, this seems to need to be specified in Sleekxmpp.

The below diff does that. First True says to retry, use TLS is set to False, use legacy SSL set to true.

jbuitt commented 4 years ago

Thank you for reporting this. I'm using Python 3.6 on my dev box and using TLS works there. I have updated the code to include options for setting retry, use_tls, and use_ssl so users can set the options appropriately on their machine to get a working connection.