Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -27,9 +27,10 @@ sys.path.append(parent_dir)
|
|
| 27 |
|
| 28 |
tf = TimezoneFinder()
|
| 29 |
CHOICES = ["cloudBase", "cloudCeiling", "dewPoint", "evapotranspiration", "freezingRainIntensity", "humidity", "iceAccumulation", "pressureSurfaceLevel", "rainAccumulation", "rainIntensity", "sleetAccumulation", "sleetIntensity", "snowAccumulation", "snowDepth", "snowIntensity", "temperature", "temperatureApparent", "uvHealthConcern", "uvIndex", "visibility", "windDirection", "windGust", "windSpeed"]
|
|
|
|
| 30 |
|
| 31 |
def getGPS():
|
| 32 |
-
GPSurl =
|
| 33 |
data = {'homeMobileCountryCode': 310, 'homeMobileNetworkCode': 410, 'considerIp': 'True'}
|
| 34 |
response = requests.post(GPSurl, data=json.dumps(data))
|
| 35 |
result = json.loads(response.content)
|
|
@@ -170,7 +171,7 @@ def server(input, output, session):
|
|
| 170 |
|
| 171 |
# # Check if it's on time locally
|
| 172 |
# if(weather_data == None or (current_time.minute == 0 and current_time.second == 0)):
|
| 173 |
-
weather_url = f"https://api.tomorrow.io/v4/weather/forecast?location={lat},{lon}&apikey=
|
| 174 |
response = requests.get(weather_url)
|
| 175 |
if response.status_code != 200:
|
| 176 |
raise Exception(f"Error fetching {weather_url}: {response.status_code}")
|
|
|
|
| 27 |
|
| 28 |
tf = TimezoneFinder()
|
| 29 |
CHOICES = ["cloudBase", "cloudCeiling", "dewPoint", "evapotranspiration", "freezingRainIntensity", "humidity", "iceAccumulation", "pressureSurfaceLevel", "rainAccumulation", "rainIntensity", "sleetAccumulation", "sleetIntensity", "snowAccumulation", "snowDepth", "snowIntensity", "temperature", "temperatureApparent", "uvHealthConcern", "uvIndex", "visibility", "windDirection", "windGust", "windSpeed"]
|
| 30 |
+
gpsurl = 'https://www.googleapis.com/geolocation/v1/geolocate?key=' + os.environ.get("GMAP_TOKEN")
|
| 31 |
|
| 32 |
def getGPS():
|
| 33 |
+
GPSurl = gpsurl
|
| 34 |
data = {'homeMobileCountryCode': 310, 'homeMobileNetworkCode': 410, 'considerIp': 'True'}
|
| 35 |
response = requests.post(GPSurl, data=json.dumps(data))
|
| 36 |
result = json.loads(response.content)
|
|
|
|
| 171 |
|
| 172 |
# # Check if it's on time locally
|
| 173 |
# if(weather_data == None or (current_time.minute == 0 and current_time.second == 0)):
|
| 174 |
+
weather_url = f"https://api.tomorrow.io/v4/weather/forecast?location={lat},{lon}&apikey={os.environ.get("WEATHER_TOKEN")}"
|
| 175 |
response = requests.get(weather_url)
|
| 176 |
if response.status_code != 200:
|
| 177 |
raise Exception(f"Error fetching {weather_url}: {response.status_code}")
|