Mrinank-Bhowmick / python-beginner-projects

Explore a collection of beginner-friendly Python projects that can be completed with minimal code. Perfect for learning the basics and improving your coding skills.
https://github.com/Mrinank-Bhowmick/python-beginner-projects/wiki
MIT License
1.14k stars 632 forks source link

Add wind direction to the API Based Weather Report #744

Open yanliutafewa opened 4 months ago

yanliutafewa commented 4 months ago

Hi there,

As for the sub project "API Based Weather Report", I think it's a good idea to add "wind direction" to the output. Because the wind direction in the json API response is a degree - like “70” instead of a natural direction - like “ENE”, it also needs to be converted.
Hope I can have the honor to add this.

best, Yan

yanliutafewa commented 4 months ago

Could you please assign this to me @Mrinank-Bhowmick :)

yanliutafewa commented 4 months ago

Thank you! @Mrinank-Bhowmick

Best, Yan

yanliutafewa commented 4 months ago

Hi, Team

I improved the functionalities of "API Based Weather Report" by adding features:

  1. Get and present “sunrise time” and “sunset time” for the city. It contains a function to convert the unix timestamp to local time.
  2. Get and present “wind direction”. It contains a function to convert a degree to a direction.
  3. Let user determine whether they want the temperature to be presented in Celsius or Fahrenheit.
  4. Add ‘Country’ to outputs, since some cities have the same name but in different country.
  5. Add output message when the API key is invalid.
  6. Add output message when the city is not found. To improve the maintainability for the program, I am also added docstrings and unit test class.

Now, I'm going to create a pull request for my updates.

Best, Yan