Skip to main content

Python-Open-Weather

Installation

pip install python-open-weather

Using git

git clone https://github.com/pmk456/python-open-weather
cd py_open_weather
python setup.py install

Usage

Get Weather Of a City

from weather import Weather
weather = Weather(temperature_unit=None) # Celsius (or) Kelvin (or) Fahrenheit
current_weather = weather.fetch_weather(city='CityName', only_temp=False) # if only_temp is set To True It Will Only return The current temperature in given unit
print(current_weather) # Returns Dictionary with City name, Temperature, Humidity, Pressure, Description
[+] OUTPUT IF TEMPERATURE_UNIT IS NONE
{'City: ': 'Kadiri', 'Temperature In Kelvin: ': '304°K', 'Temperature In Celsius: ': '31°C', 'Temperature In Fahrenheit: ': '88°F', 'Pressure: ': 1008, 'Humidity: ': 42, 'Description: ': 'overcast clouds'}
[+] OUTPUT IF TEMPERATURE UNIT IS SET CELSIUS OR KELVIN OR FAHRENHEIT
{'City: ': 'Kadiri', 'Temperature: ': '{TEMPERATURE IN C OR K OR F}', 'Pressure: ': 1008, 'Humidity: ': 42, 'Description: ': 'overcast clouds'}
[+] OUTPUT IF ONLY_TEMP IS SET TO TRUE
31°C

Get A Table With Temperatures of given city list

# Note: This uses prettytable Module So please Install it Using [ pip install prettytable ]
from weather import Weather, celsius
weather = Weather(temperature_unit=celsius)
city = ['Kadiri', 'Hindupur', 'Anantapur', 'Bangalore', 'Kolkata', 'Mumbai']
table = weather.fetch_multiple_city_weather(city)
print(table)
[+] OUTPUT
+-----------------------------------------------------------------+
|                           Weather Data                        |
+-----------+-------------+----------+----------+-----------------+
|    City   | Temperature | Pressure | Humidity |   Description   |
+-----------+-------------+----------+----------+-----------------+
|   Kadiri  |     31°C    |   1008   |    42    | overcast clouds |
|  Hindupur |     29°C    |   1009   |    50    | overcast clouds |
| Anantapur |     32°C    |   1008   |    46    | overcast clouds |
| Bangalore |     26°C    |   941    |    64    |    few clouds   |
|  Kolkata  |     30°C    |   1004   |    89    |       haze      |
|   Mumbai  |     29°C    |   1008   |    84    |       haze      |
+-----------+-------------+----------+----------+-----------------+

Release files for python-open-weather 1.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for python-open-weather 1.6
File Size Uploaded
python-open-weather-1.6.tar.gz 8.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for python-open-weather 1.6
File Interpreter ABI Platform
python_open_weather-1.6-py3-none-any.whl Python 3 none any Details

Total release size: 16.1 kB

Release files / python-open-weather-1.6.tar.gz

Download URL python-open-weather-1.6.tar.gz
Size 8.0 kB
Tags Source
SHA-256 checksum
How to use checksums
b313e9942484a73f66c25f35f0cc86ca971bb1116a698f3113f66f3512127239
BLAKE2b-256 checksum
How to use checksums
f0edc049ea734504eb097dc3a5c7fcbc171c329b95acc6ce0caf96fffa93bfff
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.9.5

Release files / python_open_weather-1.6-py3-none-any.whl

Download URL python_open_weather-1.6-py3-none-any.whl
Size 8.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
74bd1a8302ec1272d4c79ac29dc2636d1e9ffb20ba21a2f22b8a8c4dea22d798
BLAKE2b-256 checksum
How to use checksums
2418cf42a32f5810fdee2759cf096a886dd4bd88f15af8edd4c67c7719a4c61b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.9.5

Release history Release notifications | RSS feed

This release

1.6 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page