| 
						
						
							
								
							
						
						
					 | 
					 | 
					@ -17,7 +17,7 @@ def set_timezone(valid_timezones, timezone): | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    cloudlog.error(f"Timezone not supported {timezone}") | 
					 | 
					 | 
					 | 
					    cloudlog.error(f"Timezone not supported {timezone}") | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    return | 
					 | 
					 | 
					 | 
					    return | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  cloudlog.info(f"Setting timezone to {timezone}") | 
					 | 
					 | 
					 | 
					  cloudlog.debug(f"Setting timezone to {timezone}") | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  try: | 
					 | 
					 | 
					 | 
					  try: | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    if TICI: | 
					 | 
					 | 
					 | 
					    if TICI: | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      tzpath = os.path.join("/usr/share/zoneinfo/", timezone) | 
					 | 
					 | 
					 | 
					      tzpath = os.path.join("/usr/share/zoneinfo/", timezone) | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -47,7 +47,7 @@ def main(): | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    # Set based on param | 
					 | 
					 | 
					 | 
					    # Set based on param | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    timezone = params.get("Timezone", encoding='utf8') | 
					 | 
					 | 
					 | 
					    timezone = params.get("Timezone", encoding='utf8') | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    if timezone is not None: | 
					 | 
					 | 
					 | 
					    if timezone is not None: | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      cloudlog.info("Setting timezone based on param") | 
					 | 
					 | 
					 | 
					      cloudlog.debug("Setting timezone based on param") | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      set_timezone(valid_timezones, timezone) | 
					 | 
					 | 
					 | 
					      set_timezone(valid_timezones, timezone) | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      continue | 
					 | 
					 | 
					 | 
					      continue | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -55,7 +55,7 @@ def main(): | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    # Find timezone based on IP geolocation if no gps location is available | 
					 | 
					 | 
					 | 
					    # Find timezone based on IP geolocation if no gps location is available | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    if location is None: | 
					 | 
					 | 
					 | 
					    if location is None: | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      cloudlog.info("Setting timezone based on IP lookup") | 
					 | 
					 | 
					 | 
					      cloudlog.debug("Setting timezone based on IP lookup") | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      try: | 
					 | 
					 | 
					 | 
					      try: | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        r = requests.get("https://ipapi.co/timezone", timeout=10) | 
					 | 
					 | 
					 | 
					        r = requests.get("https://ipapi.co/timezone", timeout=10) | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        if r.status_code == 200: | 
					 | 
					 | 
					 | 
					        if r.status_code == 200: | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -70,7 +70,7 @@ def main(): | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    # Find timezone by reverse geocoding the last known gps location | 
					 | 
					 | 
					 | 
					    # Find timezone by reverse geocoding the last known gps location | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    else: | 
					 | 
					 | 
					 | 
					    else: | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      cloudlog.info("Setting timezone based on GPS location") | 
					 | 
					 | 
					 | 
					      cloudlog.debug("Setting timezone based on GPS location") | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      try: | 
					 | 
					 | 
					 | 
					      try: | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        location = json.loads(location) | 
					 | 
					 | 
					 | 
					        location = json.loads(location) | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      except Exception: | 
					 | 
					 | 
					 | 
					      except Exception: | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
					 | 
					
  |