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.0.tar.gz (6.2 kB view details)

Uploaded Source

Built Distribution

weatherkit-1.0.0-py3-none-any.whl (8.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: weatherkit-1.0.0.tar.gz
  • Upload date:
  • Size: 6.2 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.0.tar.gz
Algorithm Hash digest
SHA256 f9205fbe9a5c38018f46696f8e7549ef58e13f196b33cbf2e63798845d5bd3ac
MD5 378c35d71002426b4ec058e97012ebb2
BLAKE2b-256 c277f45deab7343b10945bc9e073c93d896496b53add547f3eaeba57d8080eb2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: weatherkit-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 8.0 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 222ede6e7995cd1943e369b2fa5f532a9ea4edf1ec941ad01e5ff16ef664e3d8
MD5 aeba12daa3f0bfe9be82b55d327b040d
BLAKE2b-256 947fded173a68736a287f4b78dd3c1fdd4b85fd739a904dc973c51069d970c9e

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