def refresh_weather(self): self.philly_weather = YahooWeather(APP_ID="RVSaie5a", api_key="my_key", api_secret="my_secret") self.philly_weather.get_yahoo_weather_by_city("philadelphia", Unit.fahrenheit) print("Updated weather")
def weather_by_location(request, latitude, longitude): if request.method == 'GET': print(latitude, longitude) try: weather = YahooWeather(APP_ID=AppId, api_key=ClientId, api_secret=ClientSecret) weather.get_yahoo_weather_by_location(latitude, longitude) except: return Response(status=status.HTTP_404_NOT_FOUND) data = Weather( city=weather.location.city, temperature=weather.current_observation.condition.temperature, country=weather.location.country, wind_speed=weather.current_observation.wind.speed, humidity=weather.current_observation.atmosphere.humidity, pressure=weather.current_observation.atmosphere.pressure, condition=weather.current_observation.condition.text, pubDate=weather.current_observation.pubDate) w_serializer = WeatherSerializer(data) forcasts = [] for forecast in weather.forecasts: newforecast = Forecast(day=forecast.day, weather=data, lowest_temp=forecast.low, highest_temp=forecast.high, condition=forecast.text) f_serializer = ForecastSerializer(newforecast) forcasts.append(f_serializer.data) return Response([w_serializer.data, forcasts])
def get_city_weather(city=None, lat=None, lon=None): data = YahooWeather(APP_ID=app_ID, api_key=consumer_key, api_secret=consumer_secret) if city: weather = data.get_yahoo_weather_by_city(city, Unit.celsius) else: weather = data.get_yahoo_weather_by_location(lat, lon, Unit.celsius) if weather: sunny = [32, 36] cloudy = [19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30] snowy = [5, 6, 7, 8, 9, 10, 14, 15, 16, 41, 42, 43, 46] stormy = [ 0, 1, 2, 3, 4, 11, 12, 13, 17, 18, 35, 37, 38, 39, 40, 45, 47 ] supermoon = [31, 33, 34, 44] # Get the location location = data.get_location().__dict__ # print(condition) # Get the condition condition = data.get_condition().__dict__ # print(condition) # Get the forecasts forecasts = [] for day in data.get_forecasts(): forecasts.append(day.__dict__) # print(forecasts) wind = data.get_wind() # print(wind.__dict__) humidity = data.get_atmosphere().__dict__['humidity'] astronomy = data.get_astronomy().__dict__ return { 'location': location, 'condition': condition, 'forecasts': forecasts, 'wind': wind, 'humidity': humidity, 'astronomy': astronomy, # icones 'sunny': sunny, 'cloudy': cloudy, 'snowy': snowy, 'stormy': stormy, 'supermoon': supermoon, 'today': datetime.datetime.now().strftime("%A"), } else: return {'error': True, 'city': city}
def weather_setup(): weather_access = YahooWeather(APP_ID="YourID", api_key="YourKey", api_secret="YourSecret") weather_access.get_yahoo_weather_by_city("Erp", Unit.celsius) weather = weather_access.condition.text weather_temp = weather_access.condition.temperature return weather, weather_temp
def __init__(self, city): self.city = city weather = YahooWeather(APP_ID="Your App ID", api_key="Your API KEY", api_secret="Your API secret") weather.get_yahoo_weather_by_city(self.city) self.temperature = weather.condition.temperature self.weather_conditions = weather.condition.text self.wind_speed = weather.wind.speed
def __init__(self, app_id=None, api_key=None, api_secret=None): super(YahooWeatherAPI, self).__init__() self.app_id = app_id if app_id else self.DEFAULT_APP_ID self.api_key = api_key if api_key else self.DEFAULT_API_KEY self.api_secret = api_secret if api_secret else self.DEFAULT_API_SECRET self.data = YahooWeather( APP_ID=self.app_id, api_key=self.api_key, api_secret=self.api_secret )
class WeatherService: def __init__(self): self.weather_service = YahooWeather(APP_ID=config.YAHOO_CLIENT_ID, api_key=config.YAHOO_CLIENT_KEY, api_secret=config.YAHOO_CLIENT_SECRET) def getWeatherByCity(self, city): self.weather_service.get_yahoo_weather_by_city(city, Unit.celsius) cond = config.WEATHER_CONSTANTS[str(self.weather_service.condition.code)] temp = self.weather_service.condition.temperature return cond, temp def getForecastsByCity(self, city): self.weather_service.get_yahoo_weather_by_city(city, Unit.celsius) return self.weather_service.forecasts
class YahooWeatherAPI(WeatherAPIBase): DEFAULT_APP_ID = os.getenv('YAHOO_APP_ID', '') DEFAULT_API_KEY = os.getenv('YAHOO_API_KEY', '') DEFAULT_API_SECRET = os.getenv('YAHOO_API_SECRET', '') def __init__(self, app_id=None, api_key=None, api_secret=None): super(YahooWeatherAPI, self).__init__() self.app_id = app_id if app_id else self.DEFAULT_APP_ID self.api_key = api_key if api_key else self.DEFAULT_API_KEY self.api_secret = api_secret if api_secret else self.DEFAULT_API_SECRET self.data = YahooWeather( APP_ID=self.app_id, api_key=self.api_key, api_secret=self.api_secret ) def get_weather_by_city(self, city, *args, **kwargs): self.data.get_yahoo_weather_by_city("tehran", Unit.celsius) return self._forecasts_to_condition(self.data.forecasts) @staticmethod def _forecasts_to_condition(forecasts): forecast_data = { i.date.date(): Condition(i.date.date(), i.text, i.low, i.high) for i in forecasts} return forecast_data def get_weather_by_location(self, lat, long, *args, **kwargs): self.data.get_yahoo_weather_by_location(lat, long) return self._forecasts_to_condition(self.data.forecasts) def forecast_to_text(self, condition: Condition): msg_tpl = "Weather of {date}:condition {condition};tempeture range {temp_low}-{temp_high} degree" msg = msg_tpl.format( date=condition.date, condition=condition.condition, temp_low=condition.low_temperature, temp_high=condition.high_temperature ) return msg
class YahooWeatherAPI(WeatherAPIBase): DEFAULT_APP_ID = os.getenv('YAHOO_APP_ID', 'sJXMrh4i') DEFAULT_API_KEY = os.getenv('YAHOO_API_KEY', 'dj0yJmk9dkhYUlZnMkJjcWM2JmQ9WVdrOWMwcFlUWEpvTkdrbWNHbzlNQS0tJnM9Y29uc3VtZXJzZWNyZXQmc3Y9MCZ4PWE5') DEFAULT_API_SECRET = os.getenv('YAHOO_API_SECRET', 'd9bb6c4495d902332e235e498595046cb2c33c02') def __init__(self, app_id=None, api_key=None, api_secret=None): super(YahooWeatherAPI, self).__init__() self.app_id = app_id if app_id else self.DEFAULT_APP_ID self.api_key = api_key if api_key else self.DEFAULT_API_KEY self.api_secret = api_secret if api_secret else self.DEFAULT_API_SECRET self.data = YahooWeather( APP_ID=self.app_id, api_key=self.api_key, api_secret=self.api_secret ) def get_weather_by_city(self, city, *args, **kwargs): self.data.get_yahoo_weather_by_city(city, Unit.celsius) return self._forecasts_to_condition(self.data.forecasts) @staticmethod def _forecasts_to_condition(forecasts): forecast_data = { i.date.date(): Condition(i.date.date(), i.text, i.low, i.high) for i in forecasts} return forecast_data def get_weather_by_location(self, lat, long, *args, **kwargs): self.data.get_yahoo_weather_by_location(lat, long) return self._forecasts_to_condition(self.data.forecasts) def forecast_to_text(self, condition: Condition): msg_tpl = "Weather of {date}:condition {condition};tempeture range {temp_low}-{temp_high} degree" msg = msg_tpl.format( date=condition.date, condition=condition.condition, temp_low=condition.low_temperature, temp_high=condition.high_temperature ) return msg
from yahoo_weather.weather import YahooWeather from yahoo_weather.config.units import Unit weather = YahooWeather(APP_ID="", api_key="", api_secret="") weather.get_yahoo_weather_by_city("Vellore", Unit.celsius) print(weather.condition.text) print(weather.condition.temperature) print(weather.condition.code) ''' weather.get_yahoo_weather_by_location(35.67194, 51.424438) print(weather.condition.text) print(weather.condition.temperature) ''' weather_code = [0, 0, 0, 0, 0, 0, 0] temperature = [0, 0, 0, 0, 0, 0, 0] new_weather = weather.get_forecasts() for i in range(0, 7): weather_code[i] = new_weather[i].code temperature[i] = new_weather[i].high #print(new_weather[i].text,new_weather[i].code,new_weather[i].high) for i in range(0, 7): print(weather_code[i], temperature[i])
def get_api_connection(self): return YahooWeather( APP_ID=self.yahoo_weather_creds_dict["app_id"], api_key=self.yahoo_weather_creds_dict["client_id"], api_secret=self.yahoo_weather_creds_dict["client_secret"] )
lcd.clear() lcd.color = GREEN sleepTime = 5 msgFile = '/home/pi/sign/msgs.txt' lastWeather = 0 weatherUpdateIntvl = 900 msgArray = [None] * 24 # Pi feature button button = Button(15) data = YahooWeather(APP_ID="", api_key="", api_secret="") # Comment out the data= lines above, the data.get_yahoo.. line below and uncomment the below # to avoid hitting the Yahoo! API and use a pre-saved object w/ weather data. #with open('data.pkl', 'rb') as input: # data = pickle.load(input) def log(msg): now = datetime.datetime.now() print(now.strftime("%m/%d/%Y %H:%M:%S") + ': ' + msg) # Weather update function def updateWeather(): global lastWeather
import urllib3 import urbandict import time import pyttsx3 engine = pyttsx3.init() import startup from yahoo_weather.weather import YahooWeather from yahoo_weather.config.units import Unit from yahoo_weather import * data = YahooWeather(APP_ID="028Rd77e", api_key="dj0yJmk9RUFrc0w0VWZNQXFzJnM9Y29uc3VtZXJzZWNyZXQmc3Y9MCZ4PTI5", api_secret="44c1753baf96b6b125a45b8fe718941d8fc8dd48") from datetime import date from datetime import datetime os.system("echo -en \"\033]0;Dave\a\"") width = os.get_terminal_size().columns os.environ['CURL_CA_BUNDLE'] = "" urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning) os.environ['PYTHONWARNINGS']="ignore:Unverified HTTPS request" def __start__(): startup.animation()
from yahoo_weather.weather import YahooWeather from yahoo_weather.config.units import Unit weather = YahooWeather(APP_ID="Your App ID", api_key="Your API KEY", api_secret="Your API secret") weather.get_yahoo_weather_by_city("tehran", Unit.celsius) print(weather.condition.text) print(weather.condition.temperature) weather.get_yahoo_weather_by_location(35.67194, 51.424438) print(weather.condition.text) print(weather.condition.temperature)
# This the example of using external module in Python # Yahoo Weather module is invoked # pip install yahoo-weather # Yahoo APP_ID is required (can be ordered here https://developer.yahoo.com/weather/?guccounter=1) from yahoo_weather.weather import YahooWeather from yahoo_weather.config.units import Unit data = YahooWeather(APP_ID="ElssVX7a", api_key="dj0yJmk9UWFZWjQ2RGNhY3BIJmQ9WVdrOVJXeHpjMVpZTjJFbWNHbzlNQS0tJnM9Y29uc3VtZXJzZWNyZXQmc3Y9MCZ4PWE0", api_secret="6e29d9f7fa9dd3c56e7a0319ecd0e51918e2f450") print('Welcome to Yahoo Weather!') print('*************************') print('Input city name (e.g. Chisinau):') city = input() data.get_yahoo_weather_by_city(city, Unit.celsius) print('Condition:',data.condition.text) print('Temperature, Celcius:',data.condition.temperature) print('Atmopshere pressure:',data.atmosphere.pressure) print('Atmosphere humidity:',data.atmosphere.humidity)
def __init__(self): self.weather_service = YahooWeather(APP_ID=config.YAHOO_CLIENT_ID, api_key=config.YAHOO_CLIENT_KEY, api_secret=config.YAHOO_CLIENT_SECRET)
import os from yahoo_weather.weather import YahooWeather from yahoo_weather.config.units import Unit from dotenv import load_dotenv load_dotenv() print("Testing Weather...") my_id = os.getenv('YAHOO_APP_ID') my_key = os.getenv('YAHOO_API_KEY') my_secret = os.getenv('YAHOO_API_SECRET') city_name = "Glasgow" weather = YahooWeather(APP_ID=my_id, api_key=my_key, api_secret=my_secret) weather.get_yahoo_weather_by_city(city_name, Unit.celsius) print(city_name) print(weather.condition.text) print(weather.condition.temperature) print("End Weather Test.")
from yahoo_weather.weather import YahooWeather from yahoo_weather.config.units import Unit data = YahooWeather( APP_ID="lMa5T450", api_key= "dj0yJmk9SE03emFqS3haUlREJmQ9WVdrOWJFMWhOVlEwTlRBbWNHbzlNQS0tJnM9Y29uc3VtZXJzZWNyZXQmc3Y9MCZ4PTEw", api_secret="f53bd8f7a002286ccf8b8a986426f6ecbf24bcb0") data.get_yahoo_weather_by_city("vienna", Unit.celsius) print(data.condition.text) print(data.condition.temperature) data.get_yahoo_weather_by_location(35.67194, 51.424438) print(data.condition.text) print(data.condition.temperature) data.get_forecasts()[1] print(data.get_forecasts()[1].as_dict())
#date doesn't need to be updated as frequently root.after(10000, show_date) # bind esc to quit root.bind("<Escape>", quit) #font settings #'system' isn't present on linux but is on any windows machine #with the fonts i went with something blocky looking to mimic the orginial, system came to mind #probably some font out there that does it better than system but eh weather_font = font.Font(family='system', size=18, weight='bold') #canvas settings w = Canvas(root, width=720, height=480, borderwidth=0) #more weather stuff data = YahooWeather(APP_ID=Y_id, api_key=Y_key, api_secret=Y_secret) def weather(*args): data.get_yahoo_weather_by_city("Durham UK", Unit.celsius) data.get_forecasts() #update the weather after 20mins root.after(20000, weather) #start the weather loop root.after(400, weather) #clock# time_text = StringVar() time_text.set(time.strftime("TIME %H:%M:%S")) date_text = StringVar() date_text.set(time.strftime("%a %B %d"))
def weather_setup(): """ Connects to the Yahoo Weather API. """ weather = YahooWeather(APP_ID=my_id, api_key=my_key, api_secret=my_secret) return weather
from yahoo_weather.weather import YahooWeather from yahoo_weather.api_handler import request_api, get_city_url, get_location_url from yahoo_weather.classes.API_param import yahoo_API_parameters from yahoo_weather.classes.atmosphere import Atmosphere from yahoo_weather.classes.astronomy import Astronomy from yahoo_weather.classes.condition import Condition from yahoo_weather.classes.current_observation import Current_Observation from yahoo_weather.classes.current_weather import Current_Weather from yahoo_weather.classes.forecasts import Forecasts from yahoo_weather.classes.location import Location from yahoo_weather.classes.wind import Wind from yahoo_weather.config.units import Unit data = YahooWeather( APP_ID="7QMMCcOS", api_key= "dj0yJmk9MlFpQTFrQnNYamx4JmQ9WVdrOU4xRk5UVU5qVDFNbWNHbzlNQT09JnM9Y29uc3VtZXJzZWNyZXQmc3Y9MCZ4PTU5", api_secret="28ba0fc7c529f17ae61f9b6cd83985ec200a4db2") data.get_yahoo_weather_by_city("vinh", Unit.celsius) # data.get_yahoo_weather_by_location(35.67194, 51.424438) #location print(data.location.city) print(data.location.region) print(data.location.country) print(data.location.lat) print(data.location.long) print(data.location.timezone_id) print("------------------------") print(data.wind.chill) print(data.wind.direction)
class GraphicsTest(SampleBase): def __init__(self, *args, **kwargs): super(GraphicsTest, self).__init__(*args, **kwargs) self.refresh_weather() def refresh_weather(self): self.philly_weather = YahooWeather(APP_ID="RVSaie5a", api_key="my_key", api_secret="my_secret") self.philly_weather.get_yahoo_weather_by_city("philadelphia", Unit.fahrenheit) print("Updated weather") def run(self): rotation = 0 offscreen_canvas = self.matrix.CreateFrameCanvas() #canvas = self.matrix font = graphics.Font() font.LoadFont("../../../fonts/5x8.bdf") weather_font = graphics.Font() weather_font.LoadFont("../../../fonts/4x6.bdf") green = graphics.Color(0, 255, 0) #graphics.DrawCircle(canvas, 15, 15, 10, green) blue = graphics.Color(0, 255, 213) yellow = graphics.Color(255, 255, 0) client = LiveSportsClient(api_key='my_key') scoreboard_index = 0 client.set_todays_nba_games_list() length_of_games_today = len(client.games_today) home_score = '' away_score = '' final = '' while True: home_score, away_score, final = client.get_scoreboard_for_todays_game( client.games_today[scoreboard_index]).get_scoreboard() #home_score = "PHI 32" #away_score = "MIN 22" #final = "FINAL" if rotation % 2 == 0: graphics.DrawText(offscreen_canvas, font, 2, 9, blue, home_score) graphics.DrawText(offscreen_canvas, font, 2, 20, blue, away_score) graphics.DrawText(offscreen_canvas, font, 2, 30, blue, final) else: #home_score = "HHI 32" #away_score = "NNN 22" #final = "INALF" graphics.DrawText(offscreen_canvas, font, 2, 9, green, home_score) graphics.DrawText(offscreen_canvas, font, 2, 20, green, away_score) graphics.DrawText(offscreen_canvas, font, 2, 30, green, final) graphics.DrawText(offscreen_canvas, weather_font, 40, 6, yellow, self.philly_weather.condition.text) graphics.DrawText(offscreen_canvas, weather_font, 55, 13, yellow, str(self.philly_weather.condition.temperature)) scoreboard_index = scoreboard_index + 1 if scoreboard_index == length_of_games_today: scoreboard_index = 0 rotation = rotation + 1 if rotation == 90000: rotation = 0 offscreen_canvas = self.matrix.SwapOnVSync(offscreen_canvas) offscreen_canvas = self.matrix.CreateFrameCanvas() time.sleep(5) home_score = '' away_score = '' final = ''
#!/usr/bin/env python3 from yahoo_weather.weather import YahooWeather from yahoo_weather.config.units import Unit def read_private_data(filename: str): with open(f"private/{filename}", "r") as f: return f.readline().strip() app_id = read_private_data("app_id") api_key = read_private_data("client_id") api_secret = read_private_data("client_secret") data = YahooWeather(APP_ID=app_id, api_key=api_key, api_secret=api_secret) data.get_yahoo_weather_by_city("Stockholm", Unit.celsius) print(data.condition.text) print(data.condition.temperature)
import time as t from datetime import datetime, timedelta from yahoo_weather.weather import YahooWeather from yahoo_weather.config.units import Unit import textfsm import pypyodbc import os import time import smtplib from email.mime.text import MIMEText import telebot import urllib.request #************************************************************************************************************************************************************** #weather data = YahooWeather(APP_ID="ApppID", api_key="KEy", api_secret="secret") #end weather #************************************************************************************************************************************************************** bot = telebot.TeleBot('rsfgsfd') me = '*****@*****.**' you = '*****@*****.**' cc = "*****@*****.**" smtp_server = 'smtp-gg.gg.gg' rcpt = cc.split(",") + [you] now = datetime.now() current_date = str(now.strftime("'%Y-%m-%d'")) #**************************************************************************************************************************************************************
import discord from discord.ext import commands from yahoo_weather.weather import YahooWeather from yahoo_weather.config.units import Unit from keys import APP_ID, API_KEY, API_SECRET data = YahooWeather(APP_ID=APP_ID, api_key=API_KEY, api_secret=API_SECRET) class City_Weather(commands.Cog): def __init__(self, client): self.client = client @commands.Cog.listener() async def on_ready(self): # await self.client.change_presence(status=discord.Status.online, activity=discord.Game('Hello There!')) print("City-Weather Cog is working") @commands.command(aliases=['city']) async def temp(self, ctx, city): print(f"{str(ctx.message.author)} asked for the weather in {city}") data.get_yahoo_weather_by_city(f"{city.lower()}", Unit.celsius) lat = data.location.lat lon = data.location.long avg_temp = data.condition.temperature temp_text = data.condition.text humidity = data.atmosphere.humidity wind_speed = data.wind.speed reply = f"Weather in {city} (lat: {lat}, long: {lon}): \n Average Day Temperature: {avg_temp} degrees C \n Condition: {temp_text} \n Humidity: {humidity}% \n Wind: {wind_speed} km/h"
def get_weather(): data = YahooWeather( APP_ID="YHtM6G4m", api_key="dj0yJmk9akZCYUNvMktDYVBKJmQ9WVdrOVdVaDBUVFpITkcwbWN" "HbzlNQS0tJnM9Y29uc3VtZXJzZWNyZXQmc3Y9MCZ4PWYz", api_secret="4ba0d4a13d3f3c8da7fa13a96de81c027feded92") data.get_yahoo_weather_by_city("beijing", Unit.celsius) weather_cn = translator.translate(data.condition.text, dest='zh-CN').text if weather_cn == '明确': weather_cn = '晴朗' weather_beijing = "北京: " + str( data.condition.temperature) + "度 " + str(weather_cn) data.get_yahoo_weather_by_city("sheffield", Unit.celsius) weather_cn = translator.translate(data.condition.text, dest='zh-CN').text if weather_cn == '明确': weather_cn = '晴朗' weather_sheffield = "谢菲尔德: " + str( data.condition.temperature) + "度 " + str(weather_cn) data.get_yahoo_weather_by_city("Nottingham", Unit.celsius) weather_cn = translator.translate(data.condition.text, dest='zh-CN').text if weather_cn == '明确': weather_cn = '晴朗' weather_Nottingham = "诺丁汉: " + str( data.condition.temperature) + "度 " + str(weather_cn) data.get_yahoo_weather_by_city("tokyo", Unit.celsius) weather_cn = translator.translate(data.condition.text, dest='zh-CN').text if weather_cn == '明确': weather_cn = '晴朗' weather_tokyo = "东京: " + str( data.condition.temperature) + "度 " + str(weather_cn) data.get_yahoo_weather_by_city("boston", Unit.celsius) weather_cn = translator.translate(data.condition.text, dest='zh-CN').text if weather_cn == '明确': weather_cn = '晴朗' weather_boston = "波士顿: " + str( data.condition.temperature) + "度 " + str(weather_cn) data.get_yahoo_weather_by_city("anshun", Unit.celsius) weather_cn = translator.translate(data.condition.text, dest='zh-CN').text if weather_cn == '明确': weather_cn = '晴朗' weather_anshun = "安顺: " + str( data.condition.temperature) + "度 " + str(weather_cn) data.get_yahoo_weather_by_city("chengdu", Unit.celsius) weather_cn = translator.translate(data.condition.text, dest='zh-CN').text if weather_cn == '明确': weather_cn = '晴朗' weather_chengdu = "成都: " + str( data.condition.temperature) + "度 " + str(weather_cn) data.get_yahoo_weather_by_city("jinan", Unit.celsius) weather_cn = translator.translate(data.condition.text, dest='zh-CN').text if weather_cn == '明确': weather_cn = '晴朗' weather_jinan = "济南: " + str( data.condition.temperature) + "度 " + str(weather_cn) data.get_yahoo_weather_by_city("shanghai", Unit.celsius) weather_cn = translator.translate(data.condition.text, dest='zh-CN').text if weather_cn == '明确': weather_cn = '晴朗' weather_shanghai = "上海: " + str( data.condition.temperature) + "度 " + str(weather_cn) data.get_yahoo_weather_by_city("guangzhou", Unit.celsius) weather_cn = translator.translate(data.condition.text, dest='zh-CN').text if weather_cn == '明确': weather_cn = '晴朗' weather_guangzhou = "广州: " + str( data.condition.temperature) + "度 " + str(weather_cn) data.get_yahoo_weather_by_city("quanzhou", Unit.celsius) weather_cn = translator.translate(data.condition.text, dest='zh-CN').text if weather_cn == '明确': weather_cn = '晴朗' weather_quanzhou = "泉州: " + str( data.condition.temperature) + "度 " + str(weather_cn) weather = weather_beijing + '\n' + weather_sheffield + '\n' + weather_Nottingham + '\n'+ weather_tokyo + '\n'\ + weather_boston + '\n' + weather_anshun + '\n' + weather_chengdu + '\n' + weather_jinan + '\n'\ + weather_shanghai + '\n' + weather_guangzhou + '\n' + weather_quanzhou return weather print(weather)