def getWeather(): print "getWeather()" global current_weather global future_weather status = weather.getWeather() current_weather = status['current_weather'] future_weather = status['future_weather']
def weather(self, obj): weather = getWeather() popup = Popup(title='Test popup', content=Label(text=weather), size_hint=(None, None), size=(400, 400)) popup.open()
def forecast_page(): #get city name from html form request city = str(request.args['city_input']) weatherData = getWeather.getWeather(city) #if city is real if weatherData != False: return render_template('forecast.html', temperature=weatherData['temperature'], icon=weatherData['icon'], summary=weatherData['summary'], city=city.title()) #if city is not real return render_template('index.html')
def startRun(self): if self.weatherPluginEntry is not None: self["statustext"].text = _("Getting weather information...") if self.weatherData is not None: self.weatherData.cancel() self.weatherData = None self.weatherData = getWeather() self.weatherData.getWeatherData( self.weatherPluginEntry.degreetype.value, self.weatherPluginEntry.weatherlocationcode.value, self.weatherPluginEntry.city.value, self.weatherPluginEntry.weatherSearchFullName.value, self.weatherPluginEntry.thingSpeakChannelID.value, self.getWeatherDataCallback, None) #self.showIcon) else: self["statustext"].text = _( "No locations defined...\nPress 'Menu' to do that.")
def index(): location="Bangalore,Karnataka" if(request.method=='POST'): location=request.form['location'] output=getWeather(location) sample=np.array(output).reshape(-1,6) out1=svm.predict(sample) out2=svm.predict(sample) out=round((out1[0]+out2[0])/2) out=int(out) print(out) ico='http://l.yimg.com/a/i/us/we/52/'+str(out)+'.gif' data=conditions[out] print(data) print(out) print(output) return render_template('index.html',output=output,data=data,ico=ico,location=location)
def text_reply(msg): getMsg = msg['Text'] fr = msg['FromUserName'] friend = itchat.search_friends(userName=fr) filename = (friend['NickName'] + '-' + fr) #以昵称+id进行记录文件命名 saveMsg.saveMsg(filename, 'user', getMsg) try: if getMsg == "天气": #天气请求判断 sendMsg = getWeather.getWeather(0) elif getPowerRate.judge(getMsg) != 0: #电费请求判断 sendMsg = getPowerRate.judge(getMsg) else: sendMsg = getTuring.getTuring(getMsg) #图灵机器人 saveMsg.saveMsg(filename, 'meme', sendMsg) except: sendMsg = '小傻豹傻掉了' saveMsg.saveMsg(filename, 'meme', sendMsg) return sendMsg
def pushVidDb(fileLoc, time): #Initialise variables for location data gpsDataFile = './gps.txt' lat = re.sub('[\n]', '', linecache.getline(gpsDataFile, 1)) long = re.sub('[\n]', '', linecache.getline(gpsDataFile, 2)) alt = re.sub('[\n]', '', linecache.getline(gpsDataFile, 3)) speed = re.sub('[\n]', '', linecache.getline(gpsDataFile, 4)) weather = getWeather.getWeather(lat, long) filename = os.path.basename(fileLoc) #Push file reference to image in Realtime DB homerefVid.push({ 'vid': filename, 'timestampVid': time, 'latVid': lat, 'longVid': long, 'altVid': alt, 'speedVid': speed, 'descriptionVid': weather[0], 'coverageVid': weather[1], 'temperatureVid': weather[2] })
def start(): weatherData = WeatherData() getWeather(weatherData) response = buildText(weatherData) readText(response) s.enter(120, 1, start)
def sessionstart(session, **kwargs): session.screen["MSNWeather"] = getWeather()
def weatherCallBack(): self.weather = getWeather() toplevel = tkinter.Toplevel() label1 = tkinter.Label(toplevel, text=self.weather, height=0, width=50) label1.pack()
def tellAboutTheDay(): my_date = date.today() greetString = "Today is " + str(my_date) + ", " + calendar.day_name[ my_date.weekday()] + ". " + str(getWeather.getWeather()) txttosp.convertToAudio(greetString) txttosp.convertToAudio("How can I help you?")
# coding: UTF-8 import getWeather import getNews weather = getWeather.getWeather() news = getNews.getNews() weather_message = "今日の天気は、" + weather[2] + "です。" + "\n最高気温は、" + weather[0] + "\n最低気温は、" + weather[1] + "です。" print(weather_message) for i in news: print("・" + i)