def getData(): cities = pywapi.get_cities_from_google('de') # or (country = 'fr', hl = 'de') locidparis = pywapi.get_loc_id_from_weather_com("Paris") locidbs = pywapi.get_loc_id_from_weather_com("Braunschweig") locidlondon = pywapi.get_loc_id_from_weather_com("London") Bs = pywapi.get_weather_from_weather_com("GMXX0013") Paris = pywapi.get_weather_from_weather_com("FRXX0076") London = pywapi.get_weather_from_weather_com("UKXX0085") datetime = time.strftime("Date: %d-%B-%Y Time: %H:%M:%S") tempBs = str(Bs['current_conditions']['temperature']) tempLondon = str(London['current_conditions']['temperature']) tempParis = str(Paris['current_conditions']['temperature']) ## pp.pprint(datetime) ## pp.pprint("Aktuelle Temperatur in Braunschweig: " + tempBs +" Grad") ## pp.pprint("Aktuelle Temperatur in London: " + tempLondon +" Grad") ## pp.pprint("Aktuelle Temperatur in Paris: " + tempParis +" Grad") werte = [('Braunschweig', tempBs, str(datetime)), ('London', tempLondon, str(datetime)), ('Paris', tempParis, str(datetime))] cursor.executemany("INSERT INTO temperatures VALUES (?,?,?)", werte) connection.commit()
def OnCountrySelect(event): CitiesEdit.Clear() result = pywapi.get_cities_from_google(str(CountryList[CountriesEdit.GetSelection()]['iso_code'])) i=0 while i < len(result): CitiesEdit.Append(result[i]['name']) i=i+1 Location.SetValue(CitiesEdit.GetStringSelection() + ", " + CountriesEdit.GetStringSelection())
def __call__(self, country_code, hl): return pywapi.get_cities_from_google(country_code, hl)
#!/usr/bin/env python import pywapi import pprint pp = pprint.PrettyPrinter(indent=4) cities = pywapi.get_cities_from_google('fr', 'de') # or (country = 'fr', hl = 'de') pp.pprint(cities)
#!/usr/bin/env python import pywapi import pprint pp = pprint.PrettyPrinter(indent=4) cities = pywapi.get_cities_from_google('fr', '') # or (country = 'fr', hl = 'de') pp.pprint(cities)