Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Agent(Thread):
- def __init__(self, url):
- Thread.__init__(self)
- self.url = url
- def run(self):
- response = urllib2.urlopen(url)
- print float(response.read())/0.00062137
- class MetarReader:
- def __init__(self, Config):
- self.myConfig = Config
- self.visibility_m = self.myConfig.visMaxHighLevel
- def getVisibility(self):
- self.PlaneLat = XPLMFindDataRef("sim/flightmodel/position/latitude")
- self.PlaneLon = XPLMFindDataRef("sim/flightmodel/position/longitude")
- latitude = XPLMGetDataf(self.PlaneLat)
- longitude = XPLMGetDataf(self.PlaneLon)
- url="http://openvfr.freyt.de/openWeather/getMetar.php?lat="+str(latitude)+"&lon="+str(longitude)+"&out=visibility_statute_mi"
- #print str(url)
- #response = urllib2.urlopen(url)
- #self.visibility_m = float(response.read())/0.00062137
- print "METAR: visibility_m:" + str(self.visibility_m)
- t = Agent(url)
- t.start()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement