コード例 #1
0
def runCountry(country):
    numberPerMinute = 0
    countryIdsList = getCitiesIdsByCountry(country)
    owmc = OpenWeatherMapClient()
    for cityId in countryIdsList:
        if numberPerMinute == 55:
            time.sleep(80)
            numberPerMinute = 0
        owmc.fiveDayForecast(cityId)
        numberPerMinute += 1
コード例 #2
0
def runAll():
    weekDay = subprocess.check_output("date '+%u'", shell=True)
    weekDay = weekDay.strip("\n")
    if weekDay == "6" or weekDay == "7":
        weekDay == randint(1, 5)
    with open("cityIDs" + weekDay) as idFile:
        numberPerMinute = 0
        for line in idFile:
            if numberPerMinute == 55:
                time.sleep(60)
                numberPerMinute = 0
            cityId = line.strip("\n")
            owmc = OpenWeatherMapClient()
            owmc.fiveDayForecast(cityId)
            numberPerMinute += 1