|
1 | 1 | # WeatherKit ☀️
|
2 | 2 | ## What is It?
|
3 |
| -WeatherKit is a python pacakge that provides a simple interface to get weather data without any API key or any other credentials. It is a simple and easy to use package that provides the current weather data of any location in the world. It can get weather details from address, city, country, or even from the latitude and longitude of the location. |
| 3 | +WeatherKit is a python pacakge that provides a simple interface to get weather data without any API key or any other credentials. It is a simple and easy to use package that provides the current weather data of any location in the world. It can get weather details from address, city, country, or latitude and longitude of the location. |
4 | 4 |
|
5 | 5 | Currently it Provies the following weather details for current time and forecast for 7 days:
|
6 | 6 | - Temperature ☀️
|
@@ -36,8 +36,69 @@ Install the package using the following command:
|
36 | 36 | pip install dist/*.whl
|
37 | 37 | ```
|
38 | 38 |
|
39 |
| -## Documentation |
40 |
| -The documentation of WeatherKit can be found [here](example.com) |
| 39 | +## Usage |
| 40 | +### Current Weather |
| 41 | +Sample usage providing city name |
| 42 | +```python |
| 43 | +import weatherkit |
| 44 | +NYC = weatherkit.current_weather('New York') |
| 45 | +print(NYC.temperature()) |
| 46 | +# Output: 20.0 |
| 47 | +print(NYC.temperature(units='imperial')) |
| 48 | +# Output: 68.0 |
| 49 | +print(NYC.humidity()) |
| 50 | +# Output: 50 |
| 51 | +print(NYC.weather_code()) |
| 52 | +# Output: 3 |
| 53 | +print(NYC.precipitation()) |
| 54 | +# Output: 0.0 |
| 55 | +``` |
| 56 | +Sample usage providing latitude and longitude |
| 57 | + |
| 58 | +```python |
| 59 | +import weatherkit |
| 60 | +NYC = weatherkit.current_weather(40.7128, -74.0060) |
| 61 | +print(NYC.temperature()) |
| 62 | +# Output: 20.0 |
| 63 | +print(NYC.temperature(units='imperial')) |
| 64 | +# Output: 68.0 |
| 65 | +print(NYC.humidity()) |
| 66 | +# Output: 50 |
| 67 | +print(NYC.weather_code()) |
| 68 | +# Output: 3 |
| 69 | +print(NYC.precipitation()) |
| 70 | +# Output: 0.0 |
| 71 | +``` |
| 72 | +### Daily Forecast |
| 73 | +Sample usage providing city name |
| 74 | +```python |
| 75 | +import weatherkit |
| 76 | +NYC = weatherkit.daily_forecast('New York') |
| 77 | +print(NYC.max_temperature()) |
| 78 | +# Output: 20.0 |
| 79 | +print(NYC.max_temperature(units='imperial')) |
| 80 | +# Output: 68.0 |
| 81 | +print(NYC.min_temperature()) |
| 82 | +# Output: 10.0 |
| 83 | +print(NYC.max_temperature(day_offset=3)) |
| 84 | +# Output: 20.0 |
| 85 | +print(NYC.max_temperature(day_offset=3, units='imperial')) |
| 86 | +# Output: 68.0 |
| 87 | +print(NYC.prediction_sum()) |
| 88 | +# Output: 0.0 |
| 89 | +print(NYC.prediction_sum(day_offset=3)) |
| 90 | +# Output: 3.2 |
| 91 | +print(NYC.prediction_sum(units='imperial')) |
| 92 | +# Output: 0.0 (in Inches) |
| 93 | +print(NYC.weather_code()) |
| 94 | +# Output: 3 |
| 95 | +print(NYC.weather_code(day_offset=3)) |
| 96 | +# Output: 3 |
| 97 | +``` |
| 98 | +#### Note |
| 99 | +- Similar to current weather, daily forecast can also be used by providing latitude and longitude. |
| 100 | + |
| 101 | +- day_offset is the number of days from today for which the forecast is required. day_offset=0 (which is default) will give the forecast for today, day_offset=1 will give the forecast for tomorrow and so on. |
41 | 102 |
|
42 | 103 | ## Contributing
|
43 | 104 | Contributions are welcome, and they are greatly appreciated! just fork the repository, make changes and create a pull request.
|
|
0 commit comments