김연우

merge listing

1 +<<<<<<< HEAD
1 import fs from 'fs/promises' 2 import fs from 'fs/promises'
2 import { login, load, logout } from './khcanvas.js'; 3 import { login, load, logout } from './khcanvas.js';
3 4
5 +=======
6 +>>>>>>> weather
......
...@@ -8,12 +8,19 @@ ...@@ -8,12 +8,19 @@
8 "name": "study-or-enjoy", 8 "name": "study-or-enjoy",
9 "version": "1.0.0", 9 "version": "1.0.0",
10 "dependencies": { 10 "dependencies": {
11 + "@types/axios": "^0.14.0",
11 "@types/selenium-webdriver": "^4.1.0", 12 "@types/selenium-webdriver": "^4.1.0",
12 <<<<<<< HEAD 13 <<<<<<< HEAD
14 +<<<<<<< HEAD
13 "csv-parser": "^3.0.0", 15 "csv-parser": "^3.0.0",
14 "eslint": "^8.15.0", 16 "eslint": "^8.15.0",
15 ======= 17 =======
16 >>>>>>> 6c6e356fa8269fbbdee92f54a6f2f16ffe2ba729 18 >>>>>>> 6c6e356fa8269fbbdee92f54a6f2f16ffe2ba729
19 +=======
20 +=======
21 + "axios": "^0.27.2",
22 +>>>>>>> weather
23 +>>>>>>> 039e1a43c37157ea46e8f87599a93f75536a140e
17 "mocha": "^10.0.0", 24 "mocha": "^10.0.0",
18 "selenium-webdriver": "^4.1.2" 25 "selenium-webdriver": "^4.1.2"
19 }, 26 },
...@@ -105,6 +112,18 @@ ...@@ -105,6 +112,18 @@
105 "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz", 112 "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz",
106 "integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==", 113 "integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==",
107 "dev": true 114 "dev": true
115 +<<<<<<< HEAD
116 +=======
117 + },
118 + "node_modules/@types/axios": {
119 + "version": "0.14.0",
120 + "resolved": "https://registry.npmjs.org/@types/axios/-/axios-0.14.0.tgz",
121 + "integrity": "sha512-KqQnQbdYE54D7oa/UmYVMZKq7CO4l8DEENzOKc4aBRwxCXSlJXGz83flFx5L7AWrOQnmuN3kVsRdt+GZPPjiVQ==",
122 + "deprecated": "This is a stub types definition for axios (https://github.com/mzabriskie/axios). axios provides its own type definitions, so you don't need @types/axios installed!",
123 + "dependencies": {
124 + "axios": "*"
125 + }
126 +>>>>>>> weather
108 }, 127 },
109 "node_modules/@types/node": { 128 "node_modules/@types/node": {
110 "version": "17.0.35", 129 "version": "17.0.35",
...@@ -216,6 +235,20 @@ ...@@ -216,6 +235,20 @@
216 "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", 235 "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz",
217 "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==" 236 "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q=="
218 }, 237 },
238 + "node_modules/asynckit": {
239 + "version": "0.4.0",
240 + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
241 + "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q=="
242 + },
243 + "node_modules/axios": {
244 + "version": "0.27.2",
245 + "resolved": "https://registry.npmjs.org/axios/-/axios-0.27.2.tgz",
246 + "integrity": "sha512-t+yRIyySRTp/wua5xEr+z1q60QmLq8ABsS5O9Me1AsE5dfKqgnCFzwiCZZ/cGNd1lq4/7akDWMxdhVlucjmnOQ==",
247 + "dependencies": {
248 + "follow-redirects": "^1.14.9",
249 + "form-data": "^4.0.0"
250 + }
251 + },
219 "node_modules/balanced-match": { 252 "node_modules/balanced-match": {
220 "version": "1.0.2", 253 "version": "1.0.2",
221 "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", 254 "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
...@@ -351,6 +384,17 @@ ...@@ -351,6 +384,17 @@
351 "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", 384 "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
352 "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" 385 "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="
353 }, 386 },
387 + "node_modules/combined-stream": {
388 + "version": "1.0.8",
389 + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
390 + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==",
391 + "dependencies": {
392 + "delayed-stream": "~1.0.0"
393 + },
394 + "engines": {
395 + "node": ">= 0.8"
396 + }
397 + },
354 "node_modules/concat-map": { 398 "node_modules/concat-map": {
355 "version": "0.0.1", 399 "version": "0.0.1",
356 "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", 400 "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
...@@ -426,6 +470,17 @@ ...@@ -426,6 +470,17 @@
426 "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", 470 "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz",
427 "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", 471 "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==",
428 "dev": true 472 "dev": true
473 +<<<<<<< HEAD
474 +=======
475 + },
476 + "node_modules/delayed-stream": {
477 + "version": "1.0.0",
478 + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
479 + "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=",
480 + "engines": {
481 + "node": ">=0.4.0"
482 + }
483 +>>>>>>> weather
429 }, 484 },
430 "node_modules/diff": { 485 "node_modules/diff": {
431 "version": "5.0.0", 486 "version": "5.0.0",
...@@ -744,6 +799,41 @@ ...@@ -744,6 +799,41 @@
744 "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.2.5.tgz", 799 "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.2.5.tgz",
745 "integrity": "sha512-WIWGi2L3DyTUvUrwRKgGi9TwxQMUEqPOPQBVi71R96jZXJdFskXEmf54BoZaS1kknGODoIGASGEzBUYdyMCBJg==", 800 "integrity": "sha512-WIWGi2L3DyTUvUrwRKgGi9TwxQMUEqPOPQBVi71R96jZXJdFskXEmf54BoZaS1kknGODoIGASGEzBUYdyMCBJg==",
746 "dev": true 801 "dev": true
802 +<<<<<<< HEAD
803 +=======
804 + },
805 + "node_modules/follow-redirects": {
806 + "version": "1.15.0",
807 + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.0.tgz",
808 + "integrity": "sha512-aExlJShTV4qOUOL7yF1U5tvLCB0xQuudbf6toyYA0E/acBNw71mvjFTnLaRp50aQaYocMR0a/RMMBIHeZnGyjQ==",
809 + "funding": [
810 + {
811 + "type": "individual",
812 + "url": "https://github.com/sponsors/RubenVerborgh"
813 + }
814 + ],
815 + "engines": {
816 + "node": ">=4.0"
817 + },
818 + "peerDependenciesMeta": {
819 + "debug": {
820 + "optional": true
821 + }
822 + }
823 + },
824 + "node_modules/form-data": {
825 + "version": "4.0.0",
826 + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz",
827 + "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==",
828 + "dependencies": {
829 + "asynckit": "^0.4.0",
830 + "combined-stream": "^1.0.8",
831 + "mime-types": "^2.1.12"
832 + },
833 + "engines": {
834 + "node": ">= 6"
835 + }
836 +>>>>>>> weather
747 }, 837 },
748 "node_modules/fs.realpath": { 838 "node_modules/fs.realpath": {
749 "version": "1.0.0", 839 "version": "1.0.0",
...@@ -1077,6 +1167,25 @@ ...@@ -1077,6 +1167,25 @@
1077 "url": "https://github.com/sponsors/sindresorhus" 1167 "url": "https://github.com/sponsors/sindresorhus"
1078 } 1168 }
1079 }, 1169 },
1170 + "node_modules/mime-db": {
1171 + "version": "1.52.0",
1172 + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
1173 + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==",
1174 + "engines": {
1175 + "node": ">= 0.6"
1176 + }
1177 + },
1178 + "node_modules/mime-types": {
1179 + "version": "2.1.35",
1180 + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz",
1181 + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
1182 + "dependencies": {
1183 + "mime-db": "1.52.0"
1184 + },
1185 + "engines": {
1186 + "node": ">= 0.6"
1187 + }
1188 + },
1080 "node_modules/minimatch": { 1189 "node_modules/minimatch": {
1081 "version": "5.0.1", 1190 "version": "5.0.1",
1082 "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.0.1.tgz", 1191 "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.0.1.tgz",
...@@ -1781,6 +1890,17 @@ ...@@ -1781,6 +1890,17 @@
1781 "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz", 1890 "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz",
1782 "integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==", 1891 "integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==",
1783 "dev": true 1892 "dev": true
1893 +<<<<<<< HEAD
1894 +=======
1895 + },
1896 + "@types/axios": {
1897 + "version": "0.14.0",
1898 + "resolved": "https://registry.npmjs.org/@types/axios/-/axios-0.14.0.tgz",
1899 + "integrity": "sha512-KqQnQbdYE54D7oa/UmYVMZKq7CO4l8DEENzOKc4aBRwxCXSlJXGz83flFx5L7AWrOQnmuN3kVsRdt+GZPPjiVQ==",
1900 + "requires": {
1901 + "axios": "*"
1902 + }
1903 +>>>>>>> weather
1784 }, 1904 },
1785 "@types/node": { 1905 "@types/node": {
1786 "version": "17.0.35", 1906 "version": "17.0.35",
...@@ -1865,6 +1985,20 @@ ...@@ -1865,6 +1985,20 @@
1865 "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", 1985 "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz",
1866 "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==" 1986 "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q=="
1867 }, 1987 },
1988 + "asynckit": {
1989 + "version": "0.4.0",
1990 + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
1991 + "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q=="
1992 + },
1993 + "axios": {
1994 + "version": "0.27.2",
1995 + "resolved": "https://registry.npmjs.org/axios/-/axios-0.27.2.tgz",
1996 + "integrity": "sha512-t+yRIyySRTp/wua5xEr+z1q60QmLq8ABsS5O9Me1AsE5dfKqgnCFzwiCZZ/cGNd1lq4/7akDWMxdhVlucjmnOQ==",
1997 + "requires": {
1998 + "follow-redirects": "^1.14.9",
1999 + "form-data": "^4.0.0"
2000 + }
2001 + },
1868 "balanced-match": { 2002 "balanced-match": {
1869 "version": "1.0.2", 2003 "version": "1.0.2",
1870 "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", 2004 "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
...@@ -1964,6 +2098,14 @@ ...@@ -1964,6 +2098,14 @@
1964 "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", 2098 "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
1965 "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" 2099 "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="
1966 }, 2100 },
2101 + "combined-stream": {
2102 + "version": "1.0.8",
2103 + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
2104 + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==",
2105 + "requires": {
2106 + "delayed-stream": "~1.0.0"
2107 + }
2108 + },
1967 "concat-map": { 2109 "concat-map": {
1968 "version": "0.0.1", 2110 "version": "0.0.1",
1969 "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", 2111 "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
...@@ -2018,6 +2160,14 @@ ...@@ -2018,6 +2160,14 @@
2018 "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", 2160 "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz",
2019 "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", 2161 "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==",
2020 "dev": true 2162 "dev": true
2163 +<<<<<<< HEAD
2164 +=======
2165 + },
2166 + "delayed-stream": {
2167 + "version": "1.0.0",
2168 + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
2169 + "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk="
2170 +>>>>>>> weather
2021 }, 2171 },
2022 "diff": { 2172 "diff": {
2023 "version": "5.0.0", 2173 "version": "5.0.0",
...@@ -2259,6 +2409,24 @@ ...@@ -2259,6 +2409,24 @@
2259 "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.2.5.tgz", 2409 "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.2.5.tgz",
2260 "integrity": "sha512-WIWGi2L3DyTUvUrwRKgGi9TwxQMUEqPOPQBVi71R96jZXJdFskXEmf54BoZaS1kknGODoIGASGEzBUYdyMCBJg==", 2410 "integrity": "sha512-WIWGi2L3DyTUvUrwRKgGi9TwxQMUEqPOPQBVi71R96jZXJdFskXEmf54BoZaS1kknGODoIGASGEzBUYdyMCBJg==",
2261 "dev": true 2411 "dev": true
2412 +<<<<<<< HEAD
2413 +=======
2414 + },
2415 + "follow-redirects": {
2416 + "version": "1.15.0",
2417 + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.0.tgz",
2418 + "integrity": "sha512-aExlJShTV4qOUOL7yF1U5tvLCB0xQuudbf6toyYA0E/acBNw71mvjFTnLaRp50aQaYocMR0a/RMMBIHeZnGyjQ=="
2419 + },
2420 + "form-data": {
2421 + "version": "4.0.0",
2422 + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz",
2423 + "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==",
2424 + "requires": {
2425 + "asynckit": "^0.4.0",
2426 + "combined-stream": "^1.0.8",
2427 + "mime-types": "^2.1.12"
2428 + }
2429 +>>>>>>> weather
2262 }, 2430 },
2263 "fs.realpath": { 2431 "fs.realpath": {
2264 "version": "1.0.0", 2432 "version": "1.0.0",
...@@ -2506,6 +2674,19 @@ ...@@ -2506,6 +2674,19 @@
2506 "is-unicode-supported": "^0.1.0" 2674 "is-unicode-supported": "^0.1.0"
2507 } 2675 }
2508 }, 2676 },
2677 + "mime-db": {
2678 + "version": "1.52.0",
2679 + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
2680 + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg=="
2681 + },
2682 + "mime-types": {
2683 + "version": "2.1.35",
2684 + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz",
2685 + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
2686 + "requires": {
2687 + "mime-db": "1.52.0"
2688 + }
2689 + },
2509 "minimatch": { 2690 "minimatch": {
2510 "version": "5.0.1", 2691 "version": "5.0.1",
2511 "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.0.1.tgz", 2692 "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.0.1.tgz",
......
...@@ -13,12 +13,19 @@ ...@@ -13,12 +13,19 @@
13 "author": "", 13 "author": "",
14 "license": "", 14 "license": "",
15 "dependencies": { 15 "dependencies": {
16 + "@types/axios": "^0.14.0",
16 "@types/selenium-webdriver": "^4.1.0", 17 "@types/selenium-webdriver": "^4.1.0",
17 <<<<<<< HEAD 18 <<<<<<< HEAD
19 +<<<<<<< HEAD
18 "csv-parser": "^3.0.0", 20 "csv-parser": "^3.0.0",
19 "eslint": "^8.15.0", 21 "eslint": "^8.15.0",
20 ======= 22 =======
21 >>>>>>> 6c6e356fa8269fbbdee92f54a6f2f16ffe2ba729 23 >>>>>>> 6c6e356fa8269fbbdee92f54a6f2f16ffe2ba729
24 +=======
25 +=======
26 + "axios": "^0.27.2",
27 +>>>>>>> weather
28 +>>>>>>> 039e1a43c37157ea46e8f87599a93f75536a140e
22 "mocha": "^10.0.0", 29 "mocha": "^10.0.0",
23 "selenium-webdriver": "^4.1.2" 30 "selenium-webdriver": "^4.1.2"
24 }, 31 },
......
1 +import * as mocha from 'mocha'
2 +import * as weater from '../weather.js'
3 +
4 +mocha.describe('weather', () => {
5 + mocha.it('get tomorrow weather', async () => {
6 + weater.get_weather_forecast(new Date())
7 + .then(it => console.log(it))
8 + .catch(it => console.log(it))
9 + })
10 +
11 + mocha.it('get 7 days later weather', async () => {
12 + const date = new Date()
13 + date.setDate(new Date().getDate() + 7)
14 +
15 + weater.get_weather_forecast(date)
16 + .then(it => console.log(it))
17 + .catch(it => console.log(it))
18 + })
19 +});
...\ No newline at end of file ...\ No newline at end of file
1 +//@ts-check
2 +/* eslint-disable no-unused-vars */
3 +import * as axios from 'axios';
4 +
5 +
6 +// 최대 7 일간 예보를 반환합니다. 경희대 국제캠퍼스 정문 앞 삼거리 기준으로 호출됩니다.
7 +// 5/27일에 호출했을 경우 6/3일까지의 정오 (한국표준시 기준) 결과를 반환할 수 있습니다.
8 +// 정오 기준, 가장 가까운 날짜의 예보를 반환합니다.
9 +// 예) 호출한 날짜로부터 한 달 뒤 호출 => 호출한 날짜로부터 일주일 뒤 날짜 반환 (최대가 일주일이므로)
10 +// 예) 6/2일 오후 4시 호출 => 6/2일 정오 날씨 반환 (정오 기준이므로)
11 +// 온도의 경우 단위는 섭씨입니다.
12 +
13 +/*example
14 +
15 + "dt": 1653620400,
16 + "sunrise": 1653596132,
17 + "sunset": 1653648142,
18 + "moonrise": 1653589560,
19 + "moonset": 1653637140,
20 + "moon_phase": 0.9,
21 + "temp": {
22 + "day": 21.75,
23 + "min": 15.7,
24 + "max": 22.85,
25 + "night": 16.88,
26 + "eve": 21.29,
27 + "morn": 15.7
28 + },
29 + "feels_like": {
30 + "day": 21.13,
31 + "night": 16.35,
32 + "eve": 20.57,
33 + "morn": 15.41
34 + },
35 + "pressure": 1001,
36 + "humidity": 44,
37 + "dew_point": 8.88,
38 + "wind_speed": 5.88,
39 + "wind_deg": 273,
40 + "wind_gust": 12.32,
41 + "weather": [
42 + {
43 + "id": 500,
44 + "main": "Rain",
45 + "description": "light rain",
46 + "icon": "10d"
47 + }
48 + ],
49 + "clouds": 9,
50 + "pop": 0.2, //Probability of precipitation. The values of the parameter vary between 0 and 1, where 0 is equal to 0%, 1 is equal to 100%
51 + "rain": 0.13, //Precipitation volume, mm
52 + "uvi": 7.71 //The maximum value of UV index for the day
53 +
54 +*/
55 +export async function get_weather_forecast(date) {
56 + const lat = 37.24764302276268 //위도
57 + const lon = 127.0783992268606 //경도
58 + const api_key = "336ddd01d3d6f78782eed90d3921bc7e"
59 +
60 + const target = `https://api.openweathermap.org/data/2.5/onecall?lat=${lat}&lon=${lon}&exclude=minutely,hourly,alerts&appid=${api_key}&units=metric`
61 +
62 + return await axios.default.get(target).then(it => { return extract_from(date, it.data) })
63 +}
64 +
65 +function extract_from(date, json_response) {
66 + const target_timestamp = Math.floor(date.getTime() / 1000)
67 +
68 + const target_index = find_min_index(json_response.daily.map(it => Math.abs(it.dt - target_timestamp)))
69 +
70 + return json_response.daily[target_index]
71 +}
72 +
73 +function find_min_index(array) {
74 + let lowest_index = 0
75 + for (var i = 0; i < array.length; i++) {
76 + if (array[lowest_index] > array[i]) {
77 + lowest_index = i
78 + }
79 + }
80 +
81 + return lowest_index
82 +}
...\ No newline at end of file ...\ No newline at end of file