양선아

mid report

...@@ -5,11 +5,10 @@ from urllib.request import urlopen ...@@ -5,11 +5,10 @@ from urllib.request import urlopen
5 import pandas as pd 5 import pandas as pd
6 import requests 6 import requests
7 import os 7 import os
8 +import datetime
8 9
9 url = 'http://211.237.50.150:7080/openapi/5e5e94876b673efe7161d3240516d65476da16210a391a9d6f31224c54a1fdaf/xml/Grid_20141119000000000012_1/' 10 url = 'http://211.237.50.150:7080/openapi/5e5e94876b673efe7161d3240516d65476da16210a391a9d6f31224c54a1fdaf/xml/Grid_20141119000000000012_1/'
10 11
11 -number = 0
12 -
13 def makecsvfile(day): 12 def makecsvfile(day):
14 13
15 # file name setting 14 # file name setting
...@@ -56,7 +55,7 @@ def makecsvfile(day): ...@@ -56,7 +55,7 @@ def makecsvfile(day):
56 # 결과 확인을 위한 print 55 # 결과 확인을 위한 print
57 print(str(day), ' : ', str(i)) 56 print(str(day), ' : ', str(i))
58 # csv 파일로 내보내기 57 # csv 파일로 내보내기
59 - df.to_csv(os.path.join('./', output_file), encoding='euc-kr', index=False) 58 + df.to_csv(os.path.join('./auctiondata', output_file), encoding='euc-kr', index=False)
60 59
61 def checkdatanum(day): 60 def checkdatanum(day):
62 myurl = url +'1/1?AUCNG_DE='+str(day) 61 myurl = url +'1/1?AUCNG_DE='+str(day)
...@@ -69,10 +68,20 @@ def checkdatanum(day): ...@@ -69,10 +68,20 @@ def checkdatanum(day):
69 print(day,':',product_num) 68 print(day,':',product_num)
70 return product_num 69 return product_num
71 70
71 +i = 0
72 +last_day = datetime.date(2020,4,12)
73 +first_day = datetime.date(2020,1,1) - datetime.timedelta(days=1)
72 74
73 -days=[20200413, 20200414, 20200415, 20200416, 20200417, 20200418, 20200412] 75 +while(first_day < last_day):
76 + first_day += datetime.timedelta(days=1)
77 + makecsvfile(first_day.strftime('%Y%m%d'))
74 78
79 +'''
75 for day in days: 80 for day in days:
76 - number += checkdatanum(day) 81 + makecsvfile(day)
82 +
83 +
84 +#number += checkdatanum(day)
77 85
78 -print('week : ', number) 86 +#print('week : ', number)
87 +'''
...\ No newline at end of file ...\ No newline at end of file
......
No preview for this file type
No preview for this file type