
import os
import time
import requests
import sys


def retrieve_html(): #retrive html
    for year in range(2013,2019):  #go for each and every year,month
        for month in range(1,13):
            if(month<10):
                url='http://en.tutiempo.net/climate/0{}-{}/ws-421820.html'.format(month
                                                                          ,year)
            else:
                url='http://en.tutiempo.net/climate/{}-{}/ws-421820.html'.format(month
                                                                          ,year)
            texts=requests.get(url) #retrive text download
            text_utf=texts.text.encode('utf=8') #enconde due to some char in html tag fix it
            
            if not os.path.exists("Data/Html_Data/{}".format(year)): #if not exist in local environment check folders exist or not
                os.makedirs("Data/Html_Data/{}".format(year)) #make dir if not exist req path
            with open("Data/Html_Data/{}/{}.html".format(year,month),"wb") as output: #if exist we make open in always write byte mode
                output.write(text_utf)  #here writting corresponding text
            
        sys.stdout.flush() #flush everything we creating
        
if __name__=="__main__":
    start_time=time.time()
    retrieve_html() #calling function
    stop_time=time.time()
    print("Time taken {}".format(stop_time-start_time)) #time to execute
        
    

fd41940b1530a8e4dd616777f42594ee473a03d4
<mask token>

<mask token>


def retrieve_html():
    for year in range(2013, 2019):
        for month in range(1, 13):
            if month < 10:
                url = ('http://en.tutiempo.net/climate/0{}-{}/ws-421820.html'
                    .format(month, year))
            else:
                url = ('http://en.tutiempo.net/climate/{}-{}/ws-421820.html'
                    .format(month, year))
            texts = requests.get(url)
            text_utf = texts.text.encode('utf=8')
            if not os.path.exists('Data/Html_Data/{}'.format(year)):
                os.makedirs('Data/Html_Data/{}'.format(year))
            with open('Data/Html_Data/{}/{}.html'.format(year, month), 'wb'
                ) as output:
                output.write(text_utf)
        sys.stdout.flush()


<mask token>

<mask token>


def retrieve_html():
    for year in range(2013, 2019):
        for month in range(1, 13):
            if month < 10:
                url = ('http://en.tutiempo.net/climate/0{}-{}/ws-421820.html'
                    .format(month, year))
            else:
                url = ('http://en.tutiempo.net/climate/{}-{}/ws-421820.html'
                    .format(month, year))
            texts = requests.get(url)
            text_utf = texts.text.encode('utf=8')
            if not os.path.exists('Data/Html_Data/{}'.format(year)):
                os.makedirs('Data/Html_Data/{}'.format(year))
            with open('Data/Html_Data/{}/{}.html'.format(year, month), 'wb'
                ) as output:
                output.write(text_utf)
        sys.stdout.flush()


if __name__ == '__main__':
    start_time = time.time()
    retrieve_html()
    stop_time = time.time()
    print('Time taken {}'.format(stop_time - start_time))

import os
import time
import requests
import sys


def retrieve_html():
    for year in range(2013, 2019):
        for month in range(1, 13):
            if month < 10:
                url = ('http://en.tutiempo.net/climate/0{}-{}/ws-421820.html'
                    .format(month, year))
            else:
                url = ('http://en.tutiempo.net/climate/{}-{}/ws-421820.html'
                    .format(month, year))
            texts = requests.get(url)
            text_utf = texts.text.encode('utf=8')
            if not os.path.exists('Data/Html_Data/{}'.format(year)):
                os.makedirs('Data/Html_Data/{}'.format(year))
            with open('Data/Html_Data/{}/{}.html'.format(year, month), 'wb'
                ) as output:
                output.write(text_utf)
        sys.stdout.flush()


if __name__ == '__main__':
    start_time = time.time()
    retrieve_html()
    stop_time = time.time()
    print('Time taken {}'.format(stop_time - start_time))


import os
import time
import requests
import sys


def retrieve_html(): #retrive html
    for year in range(2013,2019):  #go for each and every year,month
        for month in range(1,13):
            if(month<10):
                url='http://en.tutiempo.net/climate/0{}-{}/ws-421820.html'.format(month
                                                                          ,year)
            else:
                url='http://en.tutiempo.net/climate/{}-{}/ws-421820.html'.format(month
                                                                          ,year)
            texts=requests.get(url) #retrive text download
            text_utf=texts.text.encode('utf=8') #enconde due to some char in html tag fix it
            
            if not os.path.exists("Data/Html_Data/{}".format(year)): #if not exist in local environment check folders exist or not
                os.makedirs("Data/Html_Data/{}".format(year)) #make dir if not exist req path
            with open("Data/Html_Data/{}/{}.html".format(year,month),"wb") as output: #if exist we make open in always write byte mode
                output.write(text_utf)  #here writting corresponding text
            
        sys.stdout.flush() #flush everything we creating
        
if __name__=="__main__":
    start_time=time.time()
    retrieve_html() #calling function
    stop_time=time.time()
    print("Time taken {}".format(stop_time-start_time)) #time to execute
        
    
