python-current-temp-api 0.0.1__py3-none-any.whl

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.
File without changes
@@ -0,0 +1,39 @@
1
+ from .base import WeatherAPIBase
2
+ import requests
3
+
4
+
5
+ class OpenMeteo(WeatherAPIBase):
6
+ def __init__(self, latitude, longitude, **kwargs):
7
+ self.latitude = latitude
8
+ self.longitude = longitude
9
+
10
+ def get_current_temperature(self):
11
+ params = {
12
+ "latitude": self.latitude,
13
+ "longitude": self.longitude,
14
+ "current_weather": True,
15
+ }
16
+ result = requests.get("https://api.open-meteo.com/v1/forecast", params=params)
17
+ result_json = result.json()
18
+ return result_json["current_weather"]["temperature"]
19
+
20
+
21
+ class OpenWeather(WeatherAPIBase):
22
+ def __init__(self, latitude, longitude, **kwargs):
23
+ self.latitude = latitude
24
+ self.longitude = longitude
25
+ self.api_token = kwargs.get("api_token")
26
+
27
+ def get_current_temperature(self):
28
+ params = {
29
+ "lat": self.latitude,
30
+ "lon": self.longitude,
31
+ "appid": self.api_token,
32
+ }
33
+ result = requests.get(
34
+ "https://api.openweathermap.org/data/2.5/weather", params=params
35
+ )
36
+ result_json = result.json()
37
+ return result_json["main"]["temp"] - 273.15
38
+
39
+
@@ -0,0 +1,10 @@
1
+ from abc import ABC, abstractmethod
2
+
3
+
4
+ class WeatherAPIBase(ABC):
5
+ def __init__(self, latitude, longitude, **kwargs):
6
+ pass
7
+
8
+ @abstractmethod
9
+ def get_current_temperature(self):
10
+ pass
@@ -0,0 +1,29 @@
1
+ Metadata-Version: 2.4
2
+ Name: python-current-temp-api
3
+ Version: 0.0.1
4
+ Summary: a simple client api module to get current temperature from service providers
5
+ Home-page: https://github.com/AliGanji14/Python-Current-Temp-Api
6
+ Author: ali Ganji
7
+ Author-email: aliganji142879@gmail.com
8
+ Project-URL: Bug Tracker, https://github.com/AliGanji14/Python-Current-Temp-Api/issues
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: License :: OSI Approved :: MIT License
11
+ Classifier: Operating System :: OS Independent
12
+ Requires-Python: >=3.6
13
+ Description-Content-Type: text/markdown
14
+ License-File: LICENSE
15
+ Requires-Dist: requests
16
+ Dynamic: author
17
+ Dynamic: author-email
18
+ Dynamic: classifier
19
+ Dynamic: description
20
+ Dynamic: description-content-type
21
+ Dynamic: home-page
22
+ Dynamic: license-file
23
+ Dynamic: project-url
24
+ Dynamic: requires-dist
25
+ Dynamic: requires-python
26
+ Dynamic: summary
27
+
28
+ # Python-Current-Temp-Api
29
+ a client to gather temperature data from different service providers over api
@@ -0,0 +1,8 @@
1
+ current_temp_api/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
+ current_temp_api/api.py,sha256=wx_-jlp6wR0nk3YhOfaaX37LN6HxlEsfr4Ug0Y84txc,1208
3
+ current_temp_api/base.py,sha256=zNIdBWcGKy7ABW8h5gwEta2lL2v9ocvCzvRk8kEjBpI,216
4
+ python_current_temp_api-0.0.1.dist-info/licenses/LICENSE,sha256=R8uhQ9odnLsKRLYstubrr7rIo_pob4_diJDSGrCZUCk,1087
5
+ python_current_temp_api-0.0.1.dist-info/METADATA,sha256=4lrRZNU2mbTVmrm8JhJpbfIVcbHfd2QY8rn5eSTExZQ,991
6
+ python_current_temp_api-0.0.1.dist-info/WHEEL,sha256=K260EYznzXsJYBQGqmI8VTxEdiZYNvDZwW9cBh9-_MA,91
7
+ python_current_temp_api-0.0.1.dist-info/top_level.txt,sha256=V37Cd032wIhabAjFCIklp2PRYLnIFs7FYi2RRl17fjA,17
8
+ python_current_temp_api-0.0.1.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (83.0.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 aliganji14
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1 @@
1
+ current_temp_api