How can I connect to NWWS-OI in Python?

63 views Asked by At

I am trying to build a program that interfaces with the NWWS Open Interface, or NWWS-OI for short. This is a service that provides NWS products over XMPP. I have an account (you have to request it), but how can I use it in Python?

I looked up "nwws-oi python", and I found https://github.com/jbuitt/nwws-python-client/. However, this will not work, as the script is intended for Linux systems, but I need to run this on a Windows system! I couldn't find any other GitHub repositories when I looked up "nwws-oi python", so how can I do this? (I ideally want a solution using slixmpp.)

Edit: Already tried porting it to Windows! Whenever I try to run it, I get this error:

INFO     Using SSL version: TLS
ERROR    Connection error.
ERROR    <TagSet object, tags 0:32:16> not in asn1Spec: <OctetString schema object, tagSet <TagSet object, tags 0:0:4>, encoding iso-8859-1>
Traceback (most recent call last):
  File "C:\Users\thest\AppData\Local\Programs\Python\Python39\lib\site-packages\sleekxmpp\xmlstream\xmlstream.py", line 1492, in _process
    if not self.__read_xml():
  File "C:\Users\thest\AppData\Local\Programs\Python\Python39\lib\site-packages\sleekxmpp\xmlstream\xmlstream.py", line 1564, in __read_xml
    self.__spawn_event(xml)
  File "C:\Users\thest\AppData\Local\Programs\Python\Python39\lib\site-packages\sleekxmpp\xmlstream\xmlstream.py", line 1632, in __spawn_event
    handler.prerun(stanza_copy)
  File "C:\Users\thest\AppData\Local\Programs\Python\Python39\lib\site-packages\sleekxmpp\xmlstream\handler\callback.py", line 64, in prerun
    self.run(payload, True)
  File "C:\Users\thest\AppData\Local\Programs\Python\Python39\lib\site-packages\sleekxmpp\xmlstream\handler\callback.py", line 76, in run
    self._pointer(payload)
  File "C:\Users\thest\AppData\Local\Programs\Python\Python39\lib\site-packages\sleekxmpp\features\feature_starttls\starttls.py", line 64, in _handle_starttls_proceed
    if self.xmpp.start_tls():
  File "C:\Users\thest\AppData\Local\Programs\Python\Python39\lib\site-packages\sleekxmpp\xmlstream\xmlstream.py", line 889, in start_tls
    cert.verify(self._expected_server_name, self._der_cert)
  File "C:\Users\thest\AppData\Local\Programs\Python\Python39\lib\site-packages\sleekxmpp\xmlstream\cert.py", line 134, in verify
    cert_names = extract_names(raw_cert)
  File "C:\Users\thest\AppData\Local\Programs\Python\Python39\lib\site-packages\sleekxmpp\xmlstream\cert.py", line 72, in extract_names
    value = decoder.decode(extension.getComponentByName('extnValue'),
  File "C:\Users\thest\AppData\Local\Programs\Python\Python39\lib\site-packages\pyasn1\codec\ber\decoder.py", line 1618, in __call__
    raise error.PyAsn1Error(
pyasn1.error.PyAsn1Error: <TagSet object, tags 0:32:16> not in asn1Spec: <OctetString schema object, tagSet <TagSet object, tags 0:0:4>, encoding iso-8859-1>
INFO     Waiting for </stream:stream> from server
INFO     Negotiating TLS
INFO     Using SSL version: TLS
ERROR    Connection error.
ERROR    <TagSet object, tags 0:32:16> not in asn1Spec: <OctetString schema object, tagSet <TagSet object, tags 0:0:4>, encoding iso-8859-1>
Traceback (most recent call last):
  File "C:\Users\thest\AppData\Local\Programs\Python\Python39\lib\site-packages\sleekxmpp\xmlstream\xmlstream.py", line 1492, in _process
    if not self.__read_xml():
  File "C:\Users\thest\AppData\Local\Programs\Python\Python39\lib\site-packages\sleekxmpp\xmlstream\xmlstream.py", line 1564, in __read_xml
    self.__spawn_event(xml)
  File "C:\Users\thest\AppData\Local\Programs\Python\Python39\lib\site-packages\sleekxmpp\xmlstream\xmlstream.py", line 1632, in __spawn_event
    handler.prerun(stanza_copy)
  File "C:\Users\thest\AppData\Local\Programs\Python\Python39\lib\site-packages\sleekxmpp\xmlstream\handler\callback.py", line 64, in prerun
    self.run(payload, True)
  File "C:\Users\thest\AppData\Local\Programs\Python\Python39\lib\site-packages\sleekxmpp\xmlstream\handler\callback.py", line 76, in run
    self._pointer(payload)
  File "C:\Users\thest\AppData\Local\Programs\Python\Python39\lib\site-packages\sleekxmpp\features\feature_starttls\starttls.py", line 64, in _handle_starttls_proceed
    if self.xmpp.start_tls():
  File "C:\Users\thest\AppData\Local\Programs\Python\Python39\lib\site-packages\sleekxmpp\xmlstream\xmlstream.py", line 889, in start_tls
    cert.verify(self._expected_server_name, self._der_cert)
  File "C:\Users\thest\AppData\Local\Programs\Python\Python39\lib\site-packages\sleekxmpp\xmlstream\cert.py", line 134, in verify
    cert_names = extract_names(raw_cert)
  File "C:\Users\thest\AppData\Local\Programs\Python\Python39\lib\site-packages\sleekxmpp\xmlstream\cert.py", line 72, in extract_names
    value = decoder.decode(extension.getComponentByName('extnValue'),
  File "C:\Users\thest\AppData\Local\Programs\Python\Python39\lib\site-packages\pyasn1\codec\ber\decoder.py", line 1618, in __call__
    raise error.PyAsn1Error(
pyasn1.error.PyAsn1Error: <TagSet object, tags 0:32:16> not in asn1Spec: <OctetString schema object, tagSet <TagSet object, tags 0:0:4>, encoding iso-8859-1>
INFO     Waiting for </stream:stream> from server

Edit 2: This is what happens when it runs without pyasn1 and pyasn1_modules:

INFO     Using SSL version: TLS
WARNING  Could not find pyasn1 and pyasn1_modules. SSL certificate COULD NOT BE VERIFIED.
INFO     JID set to: [username removed]@nwws-oi.weather.gov/6fus3pafx6
WARNING  Could not find pyasn1 and pyasn1_modules. SSL certificate expiration COULD NOT BE VERIFIED.
WARNING  Use of send mask waiters is deprecated.

Then it just hangs after this!

0

There are 0 answers