Skip to content

Commit

Permalink
Go
Browse files Browse the repository at this point in the history
  • Loading branch information
engagepy committed Aug 8, 2022
1 parent 9ee023e commit 685dfad
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 79 deletions.
Binary file modified __pycache__/weathers.cpython-38.pyc
Binary file not shown.
84 changes: 25 additions & 59 deletions templates/tax.html
Original file line number Diff line number Diff line change
@@ -1,37 +1,25 @@
{% extends 'base.html' %}

{% block content %}

<div class="alert alert-primary" role="alert">
<p>
{% if total == 0 or tax == 0 %}

<h2>
Reverse Tax From Total </h2></div>



<style>
h1 {color: white; text-align: center;}
p { color: #14cff5; text-align: center;}
div {color: white; text-align: center;}
form {color: darkorange; text-align: center; width: 100%; textarea cols: "50"; }
</style>



<p>
{% if total == 0 or tax == 0 %}
<div class="alert bg-dark" role="alert">



<svg xmlns="http://www.w3.org/2000/svg" style="display: none;">
<symbol id="check-circle-fill" fill="currentColor" viewBox="0 0 16 16">
<path d="M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0zm-3.97-3.03a.75.75 0 0 0-1.08.022L7.477 9.417 5.384 7.323a.75.75 0 0 0-1.06 1.06L6.97 11.03a.75.75 0 0 0 1.079-.02l3.992-4.99a.75.75 0 0 0-.01-1.05z"/>
</symbol>
<symbol id="info-fill" fill="currentColor" viewBox="0 0 16 16">
<path d="M8 16A8 8 0 1 0 8 0a8 8 0 0 0 0 16zm.93-9.412-1 4.705c-.07.34.029.533.304.533.194 0 .487-.07.686-.246l-.088.416c-.287.346-.92.598-1.465.598-.703 0-1.002-.422-.808-1.319l.738-3.468c.064-.293.006-.399-.287-.47l-.451-.081.082-.381 2.29-.287zM8 5.5a1 1 0 1 1 0-2 1 1 0 0 1 0 2z"/>
</symbol>
<symbol id="exclamation-triangle-fill" fill="currentColor" viewBox="0 0 16 16">
<path d="M8.982 1.566a1.13 1.13 0 0 0-1.96 0L.165 13.233c-.457.778.091 1.767.98 1.767h13.713c.889 0 1.438-.99.98-1.767L8.982 1.566zM8 5c.535 0 .954.462.9.995l-.35 3.507a.552.552 0 0 1-1.1 0L7.1 5.995A.905.905 0 0 1 8 5zm.002 6a1 1 0 1 1 0 2 1 1 0 0 1 0-2z"/>
</symbol>
</svg>

<div class="alert alert-primary d-flex align-items-left" role="alert">
<svg class="bi flex-shrink-0 me-2" width="24" height="24" role="img" aria-label="Info:"><use xlink:href="#info-fill"/></svg> &nbsp;
<b>
<hr>


<h3 align = center style = "color: #14cff5">Reverse Tax Tool</h3> <h7 align = center style = "color: white"> eg: "Finding 18% Tax of all inclusive 50,000. If you simply deduct 18%, you have an incorrect answer. Hence the tool ! "</h7>
<br>
<br>

<form method ="POST" >
{{ form.hidden_tag()}}
Expand All @@ -58,14 +46,15 @@ <h2>
</p>

<hr>
</div></div>
</div>

{% else %}

<h3>
Reverse % From Total </h3>

<div class="alert alert-danger alert-dismissible fade show" role="alert">
<br>
<h3 align = center style = "color: #14cff5">Reverse Tax Tool</h3>
<br>
<br>
<br>
<div class="alert alert-primary alert-dismissible fade show" role="alert">
{% for message in get_flashed_messages() %}
<h4>
</hr>
Expand All @@ -77,34 +66,11 @@ <h4>

<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
</button></div>

</div>









<svg xmlns="http://www.w3.org/2000/svg" style="display: none;">
<symbol id="check-circle-fill" fill="currentColor" viewBox="0 0 16 16">
<path d="M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0zm-3.97-3.03a.75.75 0 0 0-1.08.022L7.477 9.417 5.384 7.323a.75.75 0 0 0-1.06 1.06L6.97 11.03a.75.75 0 0 0 1.079-.02l3.992-4.99a.75.75 0 0 0-.01-1.05z"/>
</symbol>
<symbol id="info-fill" fill="currentColor" viewBox="0 0 16 16">
<path d="M8 16A8 8 0 1 0 8 0a8 8 0 0 0 0 16zm.93-9.412-1 4.705c-.07.34.029.533.304.533.194 0 .487-.07.686-.246l-.088.416c-.287.346-.92.598-1.465.598-.703 0-1.002-.422-.808-1.319l.738-3.468c.064-.293.006-.399-.287-.47l-.451-.081.082-.381 2.29-.287zM8 5.5a1 1 0 1 1 0-2 1 1 0 0 1 0 2z"/>
</symbol>
<symbol id="exclamation-triangle-fill" fill="currentColor" viewBox="0 0 16 16">
<path d="M8.982 1.566a1.13 1.13 0 0 0-1.96 0L.165 13.233c-.457.778.091 1.767.98 1.767h13.713c.889 0 1.438-.99.98-1.767L8.982 1.566zM8 5c.535 0 .954.462.9.995l-.35 3.507a.552.552 0 0 1-1.1 0L7.1 5.995A.905.905 0 0 1 8 5zm.002 6a1 1 0 1 1 0 2 1 1 0 0 1 0-2z"/>
</symbol>
</svg>

<div class="alert alert-primary d-flex align-items-left" role="alert">
<svg class="bi flex-shrink-0 me-2" width="24" height="24" role="img" aria-label="Info:"><use xlink:href="#info-fill"/></svg> &nbsp;
<b>

<form method ="POST">
{{ form.hidden_tag()}}
Expand All @@ -121,7 +87,7 @@ <h4>

<p></p>

{{form.submit(class="btn btn-dark")}}
{{form.submit(class="btn btn-outline-info")}}


</form> </b>
Expand All @@ -131,7 +97,7 @@ <h4>
</p>

<hr>
</div></div>
</div>


{% endif %}
Expand Down
4 changes: 3 additions & 1 deletion templates/weather.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
<h3> {{message}} </h3>
<hr>
{%endfor%}
</div>
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button></div>

<p> <h3>

Expand Down
34 changes: 15 additions & 19 deletions weathers.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,45 +18,41 @@ def weather(city):
print("Geocode is ", lat_i, lng_i)

r = requests.get(
f"https://api.openweathermap.org/data/3.0/onecall?lat={lat_i}&lon={lng_i}&exclude=hourly,minutely,pressure,uvi,icon,wind_deg&lang=hi&units=metric&appid={os.environ['openweather_key']}"
f"https://api.openweathermap.org/data/3.0/onecall?lat={lat_i}&lon={lng_i}&exclude=hourly,minutely,pressure,uvi,icon,wind_deg&units=metric&appid={os.environ['openweather_key']}"
)
r = r.json()
print(r)
#print(r)
format = r['current']
format_feels = r['current']['feels_like']
vis = r['current']['visibility']
wind = r['current']['wind_speed']
formati = r['timezone']
format2 = format['temp']
format3 = format['weather'][0]['description']
format4 = format['weather'][0]['main']
format3 = str.title(format['weather'][0]['description'])

moon_phase = r['daily'][0]['moon_phase']
next_day_feels = r['daily'][0]['feels_like']['day']
next_day_desc = r['daily'][0]['weather'][0]['main']
next_day_hindi = r['daily'][0]['weather'][0]['description']

next_day_hindi = str.title(r['daily'][0]['weather'][0]['description'])
timestamp = r['current']['dt']
value = datetime.datetime.fromtimestamp(timestamp)
print(f"{value:%Y-%m-%d %H:%M:%S}")
print(moon_phase)
print(next_day_feels)
print(next_day_desc)
print(next_day_hindi)
#print(f"{value:%Y-%m-%d %H:%M:%S}")




#print(f'formatted is {format} \n {format2} \n {format3} \n \n \n {formati}')

data_refined = f'Weather -> {city}'
moon_phase_tom = f'Moon Phase = {moon_phase}'
data_refined = f'Current Weather -> {city}'
moon_phase_tom = f'Next Moon Phase = {moon_phase}'
data_refined_1 = f'Lat-Long:{lat_i} | {lng_i}'
data_feels = f'Feels = {format_feels}°C'
data_vis = f'Vis = {vis}m'
data_wind = f'Wind = {wind}'
data_wind = f'Wind = {wind} m/sec'
data_refined_2 = f'TimeZone : {formati}'
data_refined_3 = f'Temp = {format2}°C'
data_refined_4 = f'Status = {format4}, {format3}'
data_refined_4 = f'Status = {format3}'

next_day_feel = f'Tommorrow will feel = {next_day_feels}°C'
forecast_eng = f'Next Day Forecast = {next_day_desc} | {next_day_hindi}'
next_day_feel = f"Next Day Feel = {next_day_feels}°C"
forecast_eng = f"Next Day Forecast = {next_day_hindi}"

return data_refined,data_refined_3,data_feels,data_vis,data_wind, moon_phase_tom, data_refined_4,next_day_feel,forecast_eng, data_refined_2, data_refined_1
return data_refined,data_feels,data_vis,data_wind, data_refined_4,next_day_feel,forecast_eng,moon_phase_tom, data_refined_2, data_refined_1

0 comments on commit 685dfad

Please sign in to comment.