Giter Club home page Giter Club logo

meteofrance-api's Introduction

Météo-France Python API

Client Python pour l'API Météo-France. | Python client for Météo-France API.

PyPI GitHub Release Python Version License

Read the documentation at https://meteofrance-api.readthedocs.io/ Tests Codecov GitHub Activity

pre-commit Black

You will find English README content in the section For English speaking users.

Vous trouverez le contenu francophone du README dans la section Pour les francophones.

Pour les francophones

Description

Ce package Python permet de gérer la communication avec l'API non publique de Météo-France utilisée par les applications mobiles officielles.

Le client permet:

  • Rechercher des lieux de prévisions.
  • Accéder aux prévisions météorologiques horaires ou quotidiennes.
  • Accéder aux prévisions de pluie dans l'heure quand disponibles.
  • Accéder aux alertes météo pour chaque département français et d'Andorre. Deux bulletins sont disponibles : un synthétique et un second avec l'évolution des alertes pour les prochaines 24 heures (exemple ici).

Ce package a été développé avec l'intention d'être utilisé par Home-Assistant mais il peut être utilisé dans d'autres contextes.

Installation

Pour utiliser le module Python meteofrance vous devez en premier installer le package en utilisant pip depuis PyPI:

$ pip install meteofrance-api

Vous pouvez trouver un exemple d'usage dans un module Python en regardant le test d'intégration.

Contribuer

Les contributions sont les bienvenues. Veuillez consulter les bonnes pratiques détaillées dans CONTRIBUTING.rst.

For English speaking users

Description

This Python package manages the communication with the private Météo-France API used by the official mobile applications.

The client allows:

  • Search a forecast location.
  • Fetch daily or hourly weather forecast.
  • Fetch rain forecast within the next hour if available.
  • Fetch the weather alerts or phenomenoms for each French department or Andorre. Two bulletin are availabe: one basic and an other advanced with the timelaps evolution for the next 24 hours (example here).

This package have been developed to be used with Home-Assistant but it can be used in other contexts.

Installation

To use the meteofrance Python module, you have to install this package first via pip from PyPI:

$ pip install meteofrance-api

You will find an example ot usage in a Python program in the integration test.

Contributing

Contributions are welcomed. Please check the guidelines in CONTRIBUTING.rst.

Credits

This project was generated from @cjolowicz's Hypermodern Python Cookiecutter template.

meteofrance-api's People

Contributors

balloob avatar bbesset avatar cleming avatar dav1dnix avatar dependabot[bot] avatar dx44 avatar epenet avatar fabaff avatar faizpuru avatar ludovicrousseau avatar oncleben31 avatar quentame avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

meteofrance-api's Issues

Example to get historical data

Hi,
Congrats for this project!
How to get historical data with your module?

Example query: daily min temperature for 51100 Reims for date_start=2021-01-01, date_end=2021-07-31

I haven't found an example for historical data in your docs.

Thanks in advance :)

Use the v2/observation API endpoint

Is your feature request related to a problem? Please describe.
The meteo-france component in home-assistant uses current_forecast as temperature. Resulting values are discontinuous :

image

I think it is due current_forecast oscillating between observation and next forecasted temperature.

Describe the solution you'd like
A continous temperature.

Describe alternatives you've considered
The v2/observation API endpoint returns latest observation. I think it would be nice to expose it as a new method in client.py.
I've created a PR #520

Hypermodern python setup

Is your feature request related to a problem? Please describe.
Development environment setting rely on lot of manual tasks. Same thing for tests and linting.

Describe the solution you'd like
Apply the best practice from Hypermodern Python blog posts based on poetry and nox.

  • implement poetry
  • implement nox
  • implement lint checks
  • implement type hint checks
  • implement documentation for code
  • implement documentation for test
  • implement best practice for tests
  • improve CI/CD

Describe alternatives you've considered
N/A

Additional context
N/A

Générer son propre token ?

Is your feature request related to a problem? Please describe.
Bonjour, c'est un superbe projet ! Le code est vraiment simple à comprendre, c'est très utile car je suis actuellement en train d'utiliser cette API sur Javascript.

Je voudrais savoir, y a-t-il un moyen automatique pour générer son propre token plutôt que d'utiliser celui du repo ? À moins que celui-ci est fiable ?

Describe the solution you'd like
Une méthode permettant de retourner un nouveau token pour utiliser l'API.

Describe alternatives you've considered
Utiliser le token fourni par le repo, et espérer qu'il fonctionne assez longtemps.

API key for meteoFranceAPI does not give actual phenomenons

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
I had a problem to work with meteofrance-api because the API key doesn't give result of phenomenons in the function : get_warning_current_phenomenoms .
Describe the solution you'd like
A clear and concise description of what you want to happen.

  • Adding the possibility to easily change the API key and API url,
  • (if possible) Adding a new default APIkey that gives actual phenomenons with the function in the file client.py get_warning_current_phenomenoms
    Describe alternatives you've considered
    A clear and concise description of any alternative solutions or features you've considered.
    There's no real alternatives except maybe contacting meteo france concerning the api.
    Additional context
    Add any other context or screenshots about the feature request here.

Requirement is pinned for meteofrance-api 1.0.1: pytz<2021.0,>=2020.4

Describe the bug

Thanks for your support of Home Assistant!

log

(home-assistant) x:~/dev/home-assistant/core$ pip install -r requirements_all.txt
(home-assistant) x:~/dev/home-assistant/core$ pipdeptree -w silence -r -p pytz | grep meteofrance-api
  - meteofrance-api==1.0.1 [requires: pytz>=2020.4,<2021.0]

Improve tests

Describe the bug
Current test suite is mixing unit tests and end-to-end tests.

We should have a unit test suite to cover 100% of the code. And add some end-to-end tests on top to check the good integration with the Meteo-France REST API.

log
N/A

Les vitesses de vent ne correspondent pas

Avec l'API, j'obtiens des valeurs de vitesse de vent en dessous de celles affichées sur le site de Météo France.

Par example 14 au lieu de 40 km/h ou 8 au lieu de 15 km/h.

Est-ce que le problème vient de l'unité de la valeur donnée par l'API (km/h et noeuds ne correspondent pas) ou est-ce qu'il y a un calcul à faire avec cette valeur pour obtenir la vitesse réelle ?

J'utilise le champ forecast["wind"]["speed"] pour obtenir la vitesse du vent avec l'API. Est-ce le bon paramètre ou est-ce que je ne sais tout simplement pas utiliser le site de Météo France ?

Edit:
Il semblerai qu'en prenant le double de la valeur de l'API puis en la convertissant en km/h, on trouve la bonne valeur. Est-ce la bonne solution ?

Add Python 3.9 support

Is your feature request related to a problem? Please describe.
Python 3.9 released and will be the version used by HA in few weeks.

Describe the solution you'd like
Add support of Python 3.9 in test suite.

Weather icons reference ?

[Sorry not really an issue] Hi and thanks a lot for this really usefull API, I've started to use it recently and it's great but it may lack a bit of documentation. I'd like to use this API (instead of OWM api, less accurate in France) to feed my temp sensor and weather screen (using an epaper screen and domoticz) but I can't without weather icons references. In these results the weather_icon is set to "p1bisj" and I don't know where I can find a list of matches between these names and the icons:

Observation(    timezone=Europe/Paris,  time=2023-10-10T09:00:00.000Z,  temperature=19.1°C,     wind_speed=0.7 km/h,   wind_direction=87°,      wind_icon=E,    weather_icon=p1bisj,    weather_description=Peu nuageux)
{'status': 'OK', 'title': 'Update Device'}

I don't minf if it's only a named list (like here p1bisj="Peu nuageux") or a link to an icon set (like p1bisj=p1bisj.png) as I can workaround both solutions.

EDIT: just found out that the icon name can be found on meteo-france website (https://meteofrance.com/modules/custom/mf_tools_common_theme_public/svg/weather/p1bisj.svg) but, once again, a list could be usefull.

Is it possible to find this reference somewhere ?

Add description, format and unit of the parameter in the API

Is your feature request related to a problem? Please describe.
#31 shows that it could be appreciated to have a description of the current API with at least units.

Describe the solution you'd like
Could be documentation in code, wiki or external documentation.

Describe alternatives you've considered
N/A

Additional context
Easy for beginners of hacktoberfest.

Meteo France Cloud Cover between 10% and 90% - Octas ?

Bonjour l'équipe,

I'm using the meteo France integration for some time now and my values are always between 10% and 90%, never 0 or 100% (see below).

Could it be an error in the units, as cloud cover is normally defined by octas (0/8 to 8/8) ?

image

Possible values of meteofrance-api nextrain

Hello,
The nextrain prediction from the meteo france api is very useful in my case to retract my awnings.
But it would be nice to have a reference of all possible values of weather, or point to the meteofrance api specifications... I couldn't find them

Cheers !

Rename Python module name with meteofrance_api

Is your feature request related to a problem? Please describe.
Consistency with organization good practice and easier for developers.

Describe the solution you'd like
Rename the Python module and update code.

Describe alternatives you've considered
N/A

Additional context
N/A

API return 502 HTTP error when trying to get full warning

Describe the bug
When I try to get the full warnign with the "get_warning_full()" method, I get a 502 HTTP error.
The "get_warning_full()" method seams only work with Paris (75)

log

Traceback (most recent call last):
  File "/var/www/html/weather/weather.py", line 137, in <module>
    get_weather(WXCity)
  File "/var/www/html/weather/weather.py", line 46, in get_weather
    wx_warns = getWarnsFromAPI(anMeteoAPI)
  File "/var/www/html/weather/weather.py", line 35, in getWarnsFromAPI
    my_place_warn = aMeteoAPI.client.get_warning_full(aMeteoAPI.my_place.admin2)
  File "/home/pi/.local/lib/python3.9/site-packages/meteofrance_api/client.py", line 275, in get_warning_full
    resp = self.session.request("get", "warning/full", params={"domain": domain})
  File "/home/pi/.local/lib/python3.9/site-packages/meteofrance_api/session.py", line 52, in request
    response.raise_for_status()
  File "/usr/lib/python3/dist-packages/requests/models.py", line 943, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 502 Server Error: Bad Gateway for url: https://webservice.meteofrance.com/warning/full?token=__<token>__&domain=60

Where did you get the API token?

I am also trying to access Météo France's API but I don't know how to get a valid token. Can someone please explain to me how you got it?

PS: I know this isn't the right place for this kind of message, but I don't know where to ask my question... 😅

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.