Skip to main content

python API python to get active weather alerts fromhttp://vigilance.meteofrance.com/

Project description

Vigilance Météo

Build Status codecov PyPI version License: MIT

Vigilance Météo provides a python API to fetch weather alerts in France or Andorre from Météo France (http://vigilance.meteofrance.com) website.

Classes descritpion

VigilanceMeteoFranceProxy class manages the communication with the source website. The algorithm request a cheksum tiny file to download and update the XML source only when needed.

DepartmentWeatherAlert class allows to fetch all weather alerts for a french department or Andorre. Each DepartmenWeatherAlert instance can have its own proxy, but you should use only one proxy for all DepartmenWeatherAlert instances in your program to avoid too much HTTP request on source website.

Public attributes from DepartmentWeatherAlert class

  • department_color: return the overall criticity color for the department
  • additional_info_URL: return the URL to access more information about department weather alerts from the MétéoFrance website
  • bulletin_date: return the latest bulletin update date & time with timezone
  • department: get or set the department number corresponding to the area watched
  • alerts_list: return the list of all alert types
  • proxy: return the client (a VigilanceMeteoFranceProxy instance) used by the object

Public methods from DepartmentWeatherAlert class

  • update_department_status(): update alerts list by feching latest info from MétéoFrance forcast.
  • summary_message(format): return a string with textual synthesis of the active alerts in department. According to value of 'format' parameter, the string return change: 'text' (default) or 'html'

Public attributes from VigilanceMeteoFranceProxy class

  • xml_tree = XML representation of the weather alert bulletin
  • bulletin_date = Date of the bulletin (with timezone)
  • checksum = Checksum of the weather alert bulletin
  • status = current status of the proxy (possible value in constant.py)

Public Methods from VigilanceMeteoFranceProxyclass

  • update_date(): Check if new information are available and download them if any.
  • get_alert_list(department): of a given department return the list of the alerts.

Examples

>>>import vigilancemeteo

>>>zone = vigilancemeteo.DepartmentWeatherAlert('92')

>>>zone.department_color
'Jaune'

>>>zone.additional_info_URL
'http://vigilance.meteofrance.com/Bulletin_sans.html?a=dept75&b=1&c='

>>>zone.summary_message('text')
'Alerte météo Jaune en cours :\n - Vent violent: Jaune'

Installation

You can use the official release using the pyPi package. Install it with the command: pip install vigilancemeteo

Contribute

If you want to contribute to the development:

  • Start by cloning this repository.
  • Setup a virtual environment
  • Install the python package in edition mode: pip install -e .
  • Create a branch for your feature
  • Test your change using tox
  • Send a PR when ready.

References

Thank you to Lunarok to show an implementation example in PHP for Jeedom. Lot of inspiration for the first python implementation.

Since release 3.0.0, the python implementation use the the recommendation made by Météo France on www.data.gouv.fr.

License

This software is under the MIT License.

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

vigilancemeteo-3.0.1.tar.gz (11.5 kB view details)

Uploaded Source

Built Distribution

vigilancemeteo-3.0.1-py3-none-any.whl (10.8 kB view details)

Uploaded Python 3

File details

Details for the file vigilancemeteo-3.0.1.tar.gz.

File metadata

  • Download URL: vigilancemeteo-3.0.1.tar.gz
  • Upload date:
  • Size: 11.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.2

File hashes

Hashes for vigilancemeteo-3.0.1.tar.gz
Algorithm Hash digest
SHA256 70b8f957b5c8f13b2e7a0724f97aba0366161926f774b5013793c6d53f3f6fc0
MD5 98a65b0fa62eba11228a4e186495d06c
BLAKE2b-256 fd3db14faaee7556a7977fd7e8ee81a007dbe9678dcad7b904c8b8595d840b29

See more details on using hashes here.

File details

Details for the file vigilancemeteo-3.0.1-py3-none-any.whl.

File metadata

  • Download URL: vigilancemeteo-3.0.1-py3-none-any.whl
  • Upload date:
  • Size: 10.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.2

File hashes

Hashes for vigilancemeteo-3.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 acf2ba81f9b1b066309ee0f5b5be6db19e63595b11db00336ffbb1a30463229f
MD5 c28c6372ae496318995556bd25a4e692
BLAKE2b-256 55f4ad32178fb9d4c7c0e7b1d2594e0d001a23e374758c86c9e7236474b2efaa

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