weatherday 1.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,26 @@
1
+ Metadata-Version: 2.4
2
+ Name: weatherday
3
+ Version: 1.0.0
4
+ Summary: Weather forecast data
5
+ Home-page: https://example.com
6
+ Author: Praveen Kumar
7
+ Author-email: praveenkumar.srinivasanmba@gmail.com
8
+ License: MIT
9
+ Keywords: weather,forecast,openweather
10
+ Classifier: Development Status :: 3 - Alpha
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: Topic :: Software Development :: Build Tools
13
+ Classifier: License :: OSI Approved :: MIT License
14
+ Classifier: Programming Language :: Python :: 3.5
15
+ Classifier: Programming Language :: Python :: 3.6
16
+ Classifier: Programming Language :: Python :: 3.7
17
+ Classifier: Programming Language :: Python :: 3.8
18
+ Requires-Dist: requests
19
+ Dynamic: author
20
+ Dynamic: author-email
21
+ Dynamic: classifier
22
+ Dynamic: home-page
23
+ Dynamic: keywords
24
+ Dynamic: license
25
+ Dynamic: requires-dist
26
+ Dynamic: summary
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,26 @@
1
+ from setuptools import setup
2
+
3
+ setup(
4
+ name='weatherday', # Your package will have this name
5
+ packages=['weatherday'], # Name the package again
6
+ version='1.0.0', # To be increased every time you change your library
7
+ license='MIT', # Type of license. More here: https://help.github.com/articles/licensing-a-repository
8
+ description='Weather forecast data', # Short description of your library
9
+ author='Praveen Kumar', # Your name
10
+ author_email='praveenkumar.srinivasanmba@gmail.com', # Your email
11
+ url='https://example.com', # Homepage of your library (e.g. github or your website)
12
+ keywords=['weather', 'forecast', 'openweather'], # Keywords users can search on pypi.org
13
+ install_requires=[
14
+ 'requests',
15
+ ],
16
+ classifiers=[
17
+ 'Development Status :: 3 - Alpha', # Choose either "3 - Alpha", "4 - Beta" or "5 - Production/Stable" as the current state of your package
18
+ 'Intended Audience :: Developers', # Who is the audience for your library?
19
+ 'Topic :: Software Development :: Build Tools',
20
+ 'License :: OSI Approved :: MIT License', # Type a license again
21
+ 'Programming Language :: Python :: 3.5', # Python versions that your library supports
22
+ 'Programming Language :: Python :: 3.6',
23
+ 'Programming Language :: Python :: 3.7',
24
+ 'Programming Language :: Python :: 3.8',
25
+ ],
26
+ )
@@ -0,0 +1 @@
1
+ from weatherday.weatherday import Weather
@@ -0,0 +1,93 @@
1
+ import requests
2
+
3
+ class Weather:
4
+ """
5
+ Provides weather forecast information using the OpenWeatherMap API.
6
+
7
+ A Weather object can be created using either:
8
+ - A city name
9
+ - Latitude and longitude coordinates
10
+
11
+ The class fetches the 5-day weather forecast data and provides
12
+ helper methods to retrieve forecast information for the next 12 hours.
13
+
14
+ Raises:
15
+ TypeError: If neither city nor latitude/longitude is provided.
16
+ ValueError: If the API returns an invalid response.
17
+ """
18
+
19
+ def __init__(self, apiKey, city=None, lat=None, lon=None):
20
+ """
21
+ Initialize a Weather object and fetch forecast data.
22
+
23
+ Args:
24
+ apiKey (str): OpenWeatherMap API key.
25
+ city (str, optional): City name for weather lookup.
26
+ lat (float, optional): Latitude coordinate.
27
+ lon (float, optional): Longitude coordinate.
28
+
29
+ Raises:
30
+ TypeError: If neither city nor latitude/longitude is provided.
31
+ ValueError: If the provided location is invalid or no forecast data is found.
32
+ """
33
+ if city:
34
+ url = f"https://api.openweathermap.org/data/2.5/forecast?q={city}&appid={apiKey}"
35
+ result = requests.get(url)
36
+ self.data = result.json()
37
+ elif lat and lon:
38
+ url = f"https://api.openweathermap.org/data/2.5/forecast?lat={lat}&lon={lon}&appid={apiKey}"
39
+ result = requests.get(url)
40
+ self.data = result.json()
41
+ else:
42
+ raise TypeError("Please provide either city or lat and lon")
43
+
44
+ if (self.data["cod"] != "200"):
45
+ raise ValueError("Please provide valid city or lat and lon")
46
+
47
+ def next_12h(self):
48
+ """
49
+ Return raw forecast data for the next 12 hours.
50
+
51
+ OpenWeatherMap provides forecasts in 3-hour intervals.
52
+ The first four forecast entries therefore represent
53
+ approximately the next 12 hours.
54
+
55
+ Returns:
56
+ list: A list containing the next four forecast records
57
+ returned by the OpenWeatherMap API.
58
+ """
59
+ return self.data["list"][:4]
60
+
61
+ def next_12h_simplified(self):
62
+ """
63
+ Return a simplified weather forecast for the next 12 hours.
64
+
65
+ Each forecast entry contains:
66
+ - Date and time
67
+ - Temperature
68
+ - Weather description
69
+
70
+ Returns:
71
+ list[tuple]: A list of tuples in the format:
72
+
73
+ (
74
+ forecast_datetime,
75
+ temperature,
76
+ weather_description
77
+ )
78
+
79
+ Example:
80
+ [
81
+ (
82
+ '2026-06-16 12:00:00',
83
+ 301.15,
84
+ 'light rain'
85
+ )
86
+ ]
87
+ """
88
+ self_date = []
89
+ for dicty in self.data["list"][:4]:
90
+ self_date.append((dicty['dt_txt'], dicty['main']['temp'], dicty['weather'][0]['description']))
91
+
92
+ return self_date
93
+
@@ -0,0 +1,26 @@
1
+ Metadata-Version: 2.4
2
+ Name: weatherday
3
+ Version: 1.0.0
4
+ Summary: Weather forecast data
5
+ Home-page: https://example.com
6
+ Author: Praveen Kumar
7
+ Author-email: praveenkumar.srinivasanmba@gmail.com
8
+ License: MIT
9
+ Keywords: weather,forecast,openweather
10
+ Classifier: Development Status :: 3 - Alpha
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: Topic :: Software Development :: Build Tools
13
+ Classifier: License :: OSI Approved :: MIT License
14
+ Classifier: Programming Language :: Python :: 3.5
15
+ Classifier: Programming Language :: Python :: 3.6
16
+ Classifier: Programming Language :: Python :: 3.7
17
+ Classifier: Programming Language :: Python :: 3.8
18
+ Requires-Dist: requests
19
+ Dynamic: author
20
+ Dynamic: author-email
21
+ Dynamic: classifier
22
+ Dynamic: home-page
23
+ Dynamic: keywords
24
+ Dynamic: license
25
+ Dynamic: requires-dist
26
+ Dynamic: summary
@@ -0,0 +1,8 @@
1
+ setup.py
2
+ weatherday/__init__.py
3
+ weatherday/weatherday.py
4
+ weatherday.egg-info/PKG-INFO
5
+ weatherday.egg-info/SOURCES.txt
6
+ weatherday.egg-info/dependency_links.txt
7
+ weatherday.egg-info/requires.txt
8
+ weatherday.egg-info/top_level.txt
@@ -0,0 +1 @@
1
+ requests
@@ -0,0 +1 @@
1
+ weatherday