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

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: weatherkit-1.0.2.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.2.tar.gz
Algorithm Hash digest
SHA256 e41088f45c09c516abeb44396f4e68574f8ce4b55e8157b1fa76d5e5fd76233e
MD5 05af4e94d35146e8ab640315905d51f5
BLAKE2b-256 2eb51ffc8f1af541afc04c451085ef805a31b66f6c5e1039fd79adbdced3ca1f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: weatherkit-1.0.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 677395ae75bef99ed6e581f271050f59e184359c19b566a8321d38ef67df1af6
MD5 0ab2b0c672af210ed9f487becc9823d2
BLAKE2b-256 b50c0dcfd966e77c6438e125af00fbbfb86051f896bf2dc95bca9c01b3b14d11

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