aero-wheather-cli 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.
@@ -0,0 +1,7 @@
1
+ Metadata-Version: 2.4
2
+ Name: aero-wheather-cli
3
+ Version: 0.0.1
4
+ Requires-Dist: type
5
+ Requires-Dist: tabulate
6
+ Requires-Dist: requests
7
+ Dynamic: requires-dist
@@ -0,0 +1,6 @@
1
+ app.py,sha256=C81ONSETIx38zN2NNyyGdJF4i-6Lmk-YZgE7-nGGJ8k,4675
2
+ aero_wheather_cli-0.0.1.dist-info/METADATA,sha256=1nxV7oqhLZV_X9mD0KpUel86tCdtRiT5KBdDPgD7TKo,159
3
+ aero_wheather_cli-0.0.1.dist-info/WHEEL,sha256=K260EYznzXsJYBQGqmI8VTxEdiZYNvDZwW9cBh9-_MA,91
4
+ aero_wheather_cli-0.0.1.dist-info/entry_points.txt,sha256=Wb0OQLkffAJHEJUNXoKWOeejTzavbiByJ0k10RD6m5s,33
5
+ aero_wheather_cli-0.0.1.dist-info/top_level.txt,sha256=io9g7LCbfmTG1SFKgEOGXmCFB9uMP2H5lerm0HiHWQE,4
6
+ aero_wheather_cli-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,2 @@
1
+ [console_scripts]
2
+ aero = app:app
@@ -0,0 +1 @@
1
+ app
app.py ADDED
@@ -0,0 +1,135 @@
1
+ from pyowm import OWM
2
+ from dotenv import load_dotenv
3
+ import os
4
+ import typer
5
+ from tabulate import tabulate
6
+ from pyowm.commons.exceptions import NotFoundError
7
+ import requests
8
+ load_dotenv()
9
+ apiurl="https://wheather-xi-two.vercel.app/api/weather"
10
+ app=typer.Typer()
11
+ @app.command("wind")
12
+ def getwind(city:str):
13
+ try:
14
+ response=requests.get(f"{apiurl}/{city}")
15
+ data=response.json()
16
+ wind_data=[
17
+ (
18
+ "Wind Speed",f"{data['wind']}m/s"
19
+ )
20
+ ]
21
+ table=tabulate(wind_data,headers=["Details",f"Wind Details of {city}"],tablefmt="fancy_grid")
22
+ print(table)
23
+
24
+ except NotFoundError:
25
+ typer.echo(f"❌ {city} not found please check the city and try again")
26
+
27
+ @app.command("temp")
28
+ def gettemp(city:str):
29
+ try:
30
+ response=requests.get(f"{apiurl}/{city}")
31
+ data=response.json()
32
+ temp_data=[
33
+ (
34
+ "Temperature",f"{data['temp']} C"
35
+ )
36
+ ]
37
+ table=tabulate(temp_data,headers=["Details",f"Details of temp of {city}"],tablefmt="fancy_grid")
38
+ print(table)
39
+ except NotFoundError:
40
+ typer.echo("❌ City not found please check the city and try again")
41
+ @app.command("humidity")
42
+ def gethumidity(city:str):
43
+ try:
44
+ response=requests.get(f"{apiurl}/{city}")
45
+ data=response.json()
46
+ humidity_data=[
47
+ (
48
+ "Humidity",f"{data['humidity']} %"
49
+ )
50
+ ]
51
+ table=tabulate(humidity_data,headers=["Details",f"Humidity of {city}"],tablefmt="fancy_grid")
52
+ print(table)
53
+ except NotFoundError:
54
+ print("Not city not found")
55
+
56
+ @app.command("cloud")
57
+ def getclouds(city:str):
58
+ try:
59
+ response=requests.get(f"{apiurl}/{city}")
60
+ data=response.json()
61
+ cloud_data=[
62
+ (
63
+ "Clouds",f"{data['clouds']} %"
64
+ ),
65
+ (
66
+ "Condition",f"{data['condition']}"
67
+ )
68
+ ]
69
+ table=tabulate(cloud_data,headers=["Details",f"Humidity of {city}"],tablefmt="fancy_grid")
70
+ print(table)
71
+
72
+ except NotFoundError:
73
+ print("Not city not found")
74
+ @app.command("air")
75
+ def getair(city:str):
76
+ try:
77
+ response=requests.get(f"{apiurl}/{city}")
78
+ data=response.json()
79
+ air_data=[
80
+ (
81
+ "Air Pressure",f"{data['pressure']} hpa"
82
+ ),
83
+ ]
84
+ table=tabulate(air_data,headers=["Details",f"Humidity of {city}"],tablefmt="fancy_grid")
85
+ print(table)
86
+
87
+
88
+ except(NotFoundError):
89
+ print("Not city not found")
90
+
91
+ @app.command("all")
92
+ def getall(city:str):
93
+ try:
94
+ response=requests.get(f"{apiurl}/{city}")
95
+ data=response.json()
96
+ all_data=[
97
+ (
98
+ "Clouds",f"{data['clouds']} %"
99
+ ),
100
+ (
101
+ "Condition",f"{data['condition']}"
102
+ ),
103
+ (
104
+ "Air Pressure",f"{data['pressure']} hpa"
105
+ ),
106
+ (
107
+ "Humidity",f"{data['humidity']} %"
108
+ ),
109
+ (
110
+ "Wind Speed",f"{data['wind']}m/s"
111
+ ),
112
+ (
113
+ "Temperature",f"{data['temp']} C"
114
+ )
115
+ ]
116
+ table=tabulate(all_data,headers=["Details",f"Humidity of {city}"],tablefmt="fancy_grid")
117
+ print(table)
118
+
119
+ except NotFoundError:
120
+ print("Not city not found")
121
+ @app.command("help")
122
+ def showcommand():
123
+ data=[
124
+ (" wind cityName ","Gets the wind details about the city"),
125
+ (" temp cityName","Gets the temperature deatils about the city"),
126
+ ("humidity cityName","Gets the Humidity of the city"),
127
+ ("clouds cityName","Gets the Clouds of the city"),
128
+ ("air cityName","Gets the Air pressure of the city"),
129
+ ("all cityName","Get all the above details of the city in one table")
130
+ ]
131
+ table=tabulate(data,headers=["Command","What it Does"],tablefmt="fancy_grid")
132
+ print(table)
133
+
134
+ if __name__ == "__main__":
135
+ app()