Skip to main content

Get weather details of any city or latitude and longitude of the location. without an API key.

Project description

WeatherKit ☀️

What is It?

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.

Currently it Provies the following weather details for current time and forecast for 7 days:

  • Temperature ☀️
  • Humidity 💧
  • Wind Speed 💨
  • Weather Code ⛅️
  • Precipitation ☔️

Where to get it?

The easy way to get WeatherKit is from pip:

pip install weatherkit

Dependencies

geopy - For getting latitude and longitude of the location if the location is given in address or city format.

Installing from source

Download the source code by cloning the repository or by clicking here

git clone https://github.com/suvanbanerjee/weatherkit.git
cd weatherkit

Build the package using the following command:

python setup.py sdist bdist_wheel

Install the package using the following command:

pip install dist/*.whl

Usage

Current Weather

Sample usage providing city name

import weatherkit
NYC = weatherkit.current_weather('New York')
print(NYC.temperature())
# Output: 20.0
print(NYC.temperature(units='imperial'))
# Output: 68.0
print(NYC.humidity())
# Output: 50
print(NYC.weather_code())
# Output: 3
print(NYC.precipitation())
# Output: 0.0

Sample usage providing latitude and longitude

import weatherkit
NYC = weatherkit.current_weather(40.7128, -74.0060)
print(NYC.temperature())
# Output: 20.0
print(NYC.temperature(units='imperial'))
# Output: 68.0
print(NYC.humidity())
# Output: 50
print(NYC.weather_code())
# Output: 3
print(NYC.precipitation())
# Output: 0.0

Daily Forecast

Sample usage providing city name

import weatherkit
NYC = weatherkit.daily_forecast('New York')
print(NYC.max_temperature())
# Output: 20.0
print(NYC.max_temperature(units='imperial'))
# Output: 68.0
print(NYC.min_temperature())
# Output: 10.0
print(NYC.max_temperature(day_offset=3))
# Output: 20.0
print(NYC.max_temperature(day_offset=3, units='imperial'))
# Output: 68.0
print(NYC.prediction_sum())
# Output: 0.0
print(NYC.prediction_sum(day_offset=3))
# Output: 3.2
print(NYC.prediction_sum(units='imperial'))
# Output: 0.0 (in Inches)
print(NYC.weather_code())
# Output: 3
print(NYC.weather_code(day_offset=3))
# Output: 3

Note

  • Similar to current weather, daily forecast can also be used by providing latitude and longitude.

  • 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.

Contributing

Contributions are welcome, and they are greatly appreciated! just fork the repository, make changes and create a pull request.

License

WeatherKit is distributed under the MIT License. See the LICENSE file for more information.

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

weatherkit-1.0.1.tar.gz (6.4 kB view details)

Uploaded Source

Built Distribution

weatherkit-1.0.1-py3-none-any.whl (8.2 kB view details)

Uploaded Python 3

File details

Details for the file weatherkit-1.0.1.tar.gz.

File metadata

  • Download URL: weatherkit-1.0.1.tar.gz
  • Upload date:
  • Size: 6.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.2

File hashes

Hashes for weatherkit-1.0.1.tar.gz
Algorithm Hash digest
SHA256 3016a4dd60c1da36c2734ca3b2c72b58d10c9856c43a8bfad5499ec5e68da723
MD5 2fa8123f1e8e1ffa65c62f944d371241
BLAKE2b-256 575063bd6a26a28d528e642b293989a7843fadc5439f98db20d5d52e5f7fcc18

See more details on using hashes here.

File details

Details for the file weatherkit-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: weatherkit-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 8.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.2

File hashes

Hashes for weatherkit-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 75d7fdd3b587fbc7fea6fbacf97d1bcbae8be966cafc98a27c28af7dba1ce14c
MD5 c731c4ec155bb81008fcde90f192d058
BLAKE2b-256 e61f1cca8318a4edfc9c4ed200b619898c4bbded46ef899e965d1588a8b06f82

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