Skip to main content

NWS CAP Parser for Python3

Project description

Note: these values are updated every 2 minutes. The NWS server uses cache-control headers and timeouts to optimize response times.

MY_STATE = 'NC'
cap = NWSCAPParser('http://alerts.weather.gov/cap/{}.php?x=1'.format(MY_STATE))

for ID, entry in cap.entries.items():
    print('################################')
    print('ID=', ID)
    print('entry.id=', entry.id)
    print('entry=', entry)

    print('entry.severity=', entry.severity)
    print('entry.urgency=', entry.urgency)
    print('entry.certainty=', entry.certainty)

    print('entry.status=', entry.status)
    print('entry.msgType=', entry.msgType)
    print('entry.category=', entry.category)
    print('entry.areaDesc=', entry.areaDesc)

Output

################################
ID= https://alerts.weather.gov/cap/wwacapget.php?x=NC125F5E87CC18.BeachHazardsStatement.125F5E94C080NC.MHXCFWMHX.517dbba3998ca8105cf4c357df8d60e2
entry.id= https://alerts.weather.gov/cap/wwacapget.php?x=NC125F5E87CC18.BeachHazardsStatement.125F5E94C080NC.MHXCFWMHX.517dbba3998ca8105cf4c357df8d60e2
entry= <CAPEntry: {'id': 'https://alerts.weather.gov/cap/wwacapget.php?x=NC125F5E87CC18.BeachHazardsStatement.125F5E94C080NC.MHXCFWMHX.517dbba3998ca8105cf4c357df8d60e2', 'updated': '2020-08-17T11:10:00-04:00', 'published': '2020-08-17T11:10:00-04:00', 'author': {'name': 'w-nws.webmaster@noaa.gov'}, 'title': 'Beach Hazards Statement issued August 17 at 11:10AM EDT until August 17 at 8:00PM EDT by NWS', 'link': '', 'summary': '...BEACH HAZARDS STATEMENT REMAINS IN EFFECT UNTIL 8 PM EDT THIS EVENING... * WHAT...Dangerous rip currents. * WHERE...The beaches north of Cape Hatteras. * WHEN...Until 8 PM EDT this evening. * IMPACTS...Rip currents can sweep even the best swimmers away'}>
entry.severity= Moderate
entry.urgency= Expected
entry.certainty= Likely
entry.status= Actual
entry.msgType= Alert
entry.category= Met
entry.areaDesc= Hatteras Island; Northern Outer Banks
################################
ID= https://alerts.weather.gov/cap/wwacapget.php?x=NC125F5E86E924.BeachHazardsStatement.125F5E94C080NC.AKQCFWAKQ.d59a4d6449e2c689d8dd9b1209db835a
entry.id= https://alerts.weather.gov/cap/wwacapget.php?x=NC125F5E86E924.BeachHazardsStatement.125F5E94C080NC.AKQCFWAKQ.d59a4d6449e2c689d8dd9b1209db835a
entry= <CAPEntry: {'id': 'https://alerts.weather.gov/cap/wwacapget.php?x=NC125F5E86E924.BeachHazardsStatement.125F5E94C080NC.AKQCFWAKQ.d59a4d6449e2c689d8dd9b1209db835a', 'updated': '2020-08-17T05:29:00-04:00', 'published': '2020-08-17T05:29:00-04:00', 'author': {'name': 'w-nws.webmaster@noaa.gov'}, 'title': 'Beach Hazards Statement issued August 17 at 5:29AM EDT until August 17 at 8:00PM EDT by NWS', 'link': '', 'summary': '...BEACH HAZARDS STATEMENT REMAINS IN EFFECT THROUGH THIS EVENING... * WHAT...A high risk of rip currents. * WHERE...In Virginia, Virginia Beach. In North Carolina, Eastern Currituck County. * WHEN...From 8 AM EDT this morning through this evening.'}>
entry.severity= Moderate
entry.urgency= Expected
entry.certainty= Likely
entry.status= Actual
entry.msgType= Alert
entry.category= Met
entry.areaDesc= Eastern Currituck

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nwscapparser3-3.0.6.tar.gz (9.8 kB view details)

Uploaded Source

Built Distribution

nwscapparser3-3.0.6-py3-none-any.whl (12.3 kB view details)

Uploaded Python 3

File details

Details for the file nwscapparser3-3.0.6.tar.gz.

File metadata

  • Download URL: nwscapparser3-3.0.6.tar.gz
  • Upload date:
  • Size: 9.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.2

File hashes

Hashes for nwscapparser3-3.0.6.tar.gz
Algorithm Hash digest
SHA256 7292700cc9279335d3ccf9f6d5c8428d56f359dd215c952ff8c918d3a8f7681c
MD5 43d852ba3c5cf228477171cb76131c61
BLAKE2b-256 3858ae02b207c179a336fa80003a16d9dbf8126469cf554e31fc53539b454bf9

See more details on using hashes here.

File details

Details for the file nwscapparser3-3.0.6-py3-none-any.whl.

File metadata

  • Download URL: nwscapparser3-3.0.6-py3-none-any.whl
  • Upload date:
  • Size: 12.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.2

File hashes

Hashes for nwscapparser3-3.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 2c936095d7ab1e8933a981860a12fc7f6302cdb274864f326b9e64ac74ac0f44
MD5 b11badd2efc635143cb0079b9c946076
BLAKE2b-256 945c4114bdd07354c4087beecfa755a7104e942e0b31252a435e196a4bfe1aff

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page