cloudydays 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.
- cloudydays-1.0.0/PKG-INFO +26 -0
- cloudydays-1.0.0/cloudydays/__init__.py +1 -0
- cloudydays-1.0.0/cloudydays/cloudydays.py +53 -0
- cloudydays-1.0.0/cloudydays.egg-info/PKG-INFO +26 -0
- cloudydays-1.0.0/cloudydays.egg-info/SOURCES.txt +8 -0
- cloudydays-1.0.0/cloudydays.egg-info/dependency_links.txt +1 -0
- cloudydays-1.0.0/cloudydays.egg-info/requires.txt +1 -0
- cloudydays-1.0.0/cloudydays.egg-info/top_level.txt +1 -0
- cloudydays-1.0.0/setup.cfg +4 -0
- cloudydays-1.0.0/setup.py +26 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: cloudydays
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Weather forecast data
|
|
5
|
+
Home-page: https://example.com
|
|
6
|
+
Author: Yasmeen Shalabi
|
|
7
|
+
Author-email: shalabiyasmeen737@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 @@
|
|
|
1
|
+
from cloudydays.cloudydays import Weather
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import requests
|
|
2
|
+
|
|
3
|
+
#url = "https://api.openweathermap.org/data/2.5/forecast?q=Madrid&appid=0fb99a8f1507b587e934aeb045ff14ba&units=imperial"
|
|
4
|
+
#url = "https://api.openweathermap.org/data/2.5/forecast?lat=40.1&lon=3.4&appid=0fb99a8f1507b587e934aeb045ff14ba&units=imperial"
|
|
5
|
+
|
|
6
|
+
class Weather:
|
|
7
|
+
"""Creates a Weather object getting an API key as input and either a city name or long and lat coordinates.
|
|
8
|
+
|
|
9
|
+
Package use example:
|
|
10
|
+
|
|
11
|
+
# Create a weather object using a city name:
|
|
12
|
+
# The api key below is not guaranteed to work.
|
|
13
|
+
# Get your own api key from https://openweathermap.org
|
|
14
|
+
# And wait a couple of hours for the api key to be activated
|
|
15
|
+
|
|
16
|
+
>>> weather1 = Weather(apikey = "0fb99a8f1507b587e934aeb045ff14ba", city = "Madrid")
|
|
17
|
+
|
|
18
|
+
# Using latitude and longitude coordinates
|
|
19
|
+
>>> weather2 = Weather(apikey = "0fb99a8f1507b587e934aeb045ff14ba", lat = 41.1, lon = -4.1)
|
|
20
|
+
|
|
21
|
+
# Get complete weather data for the next 12 hours:
|
|
22
|
+
>>> weather1.next_12h()
|
|
23
|
+
|
|
24
|
+
# Simplified data for the next 12 hours:
|
|
25
|
+
>>> weather1.next_12h_simplified()
|
|
26
|
+
"""
|
|
27
|
+
|
|
28
|
+
def __init__(self, apikey, city=None, lat=None, lon=None):
|
|
29
|
+
if city:
|
|
30
|
+
url = f"https://api.openweathermap.org/data/2.5/forecast?q={city}&appid={apikey}&units=imperial"
|
|
31
|
+
r = requests.get(url)
|
|
32
|
+
self.data = r.json()
|
|
33
|
+
elif lat and lon:
|
|
34
|
+
url = f"https://api.openweathermap.org/data/2.5/forecast?lat={lat}&lon={lon}&appid={apikey}&units=imperial"
|
|
35
|
+
r = requests.get(url)
|
|
36
|
+
self.data = r.json()
|
|
37
|
+
else:
|
|
38
|
+
raise TypeError("Provide either a city or lat and long arguments")
|
|
39
|
+
|
|
40
|
+
if self.data["cod"] != "200":
|
|
41
|
+
raise ValueError(self.data["message"])
|
|
42
|
+
|
|
43
|
+
def next_12h(self):
|
|
44
|
+
"""Returns 3-hour data for the next 12 hours as a dict."""
|
|
45
|
+
return self.data['list'][:4]
|
|
46
|
+
|
|
47
|
+
def next_12h_simplified(self):
|
|
48
|
+
"""Returns date, temperature, and sky condition every 3 hours
|
|
49
|
+
for the next 12 hours as a tuple of tuples"""
|
|
50
|
+
simple_data = []
|
|
51
|
+
for dicty in self.data['list'][:4]:
|
|
52
|
+
simple_data.append((dicty['dt_txt'], dicty['main']['temp'], dicty['weather'][0]['description']))
|
|
53
|
+
return simple_data
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: cloudydays
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Weather forecast data
|
|
5
|
+
Home-page: https://example.com
|
|
6
|
+
Author: Yasmeen Shalabi
|
|
7
|
+
Author-email: shalabiyasmeen737@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 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
requests
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
cloudydays
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
from setuptools import setup
|
|
2
|
+
|
|
3
|
+
setup(
|
|
4
|
+
name='cloudydays', # Your package will have this name
|
|
5
|
+
packages=['cloudydays'], # 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='Yasmeen Shalabi', # Your name
|
|
10
|
+
author_email='shalabiyasmeen737@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
|
+
)
|