-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15 from Banryeo/distributeTest
v1.0.0
- Loading branch information
Showing
50 changed files
with
19,171 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
HELP.md | ||
.gradle | ||
build/ | ||
!gradle/wrapper/gradle-wrapper.jar | ||
!**/src/test/**/build/ | ||
.idea/workspace.xml | ||
|
||
### STS ### | ||
.apt_generated | ||
.classpath | ||
.factorypath | ||
.project | ||
.settings | ||
.springBeans | ||
.sts4-cache | ||
bin/ | ||
!**/src/main/**/bin/ | ||
!**/src/test/**/bin/ | ||
|
||
### IntelliJ IDEA ### | ||
.idea | ||
*.iws | ||
*.iml | ||
*.ipr | ||
out/ | ||
!**/src/main/**/out/ | ||
!**/src/test/**/out/ | ||
|
||
### NetBeans ### | ||
/nbproject/private/ | ||
/nbbuild/ | ||
/dist/ | ||
/nbdist/ | ||
/.nb-gradle/ | ||
|
||
### VS Code ### | ||
.vscode/ | ||
/frontend/node_modules/ |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
### 1. 제주시 API 관련 | ||
API가 데이터를 한 번에 10개씩 받아오기에 저장되는 json **파일은 하나지만, 그 안의 내용은 여러개의 json 파일이 합쳐진 모양입니다.** | ||
정상적인 json 형식은 []가 하나만 있어야 합니다. 소스코드대로 저장하면 ' [1번째 받은 데이터][2번째 받은 데이터][...][마지막으로 받은 데이터] ' 모양이 됩니다. | ||
텍스트 편집기로 " ][ "를 " , "로 대치하는 걸로 해결했습니다. | ||
|
||
### 2. 서귀포시 API 관련 | ||
서귀포시 API는 현재 달의 달력을 제공하고, 그 달력의 모든 행사를 요일별로 제공합니다. | ||
중복되는 데이터를 DB 내에서 중복을 제거하는 방식으로 해결했습니다. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
#!/usr/bin/env python | ||
# coding: utf-8 | ||
|
||
# In[ ]: | ||
|
||
|
||
from urllib.request import urlopen | ||
from urllib.parse import urlencode, unquote, quote_plus | ||
import requests | ||
import json | ||
import xmltodict | ||
|
||
fileName = 'jejusi.json' | ||
file = open(fileName, 'w', encoding='utf-8') | ||
|
||
// https://www.data.go.kr/data/15002244/openapi.do | ||
apiUrl = '### api url ###' | ||
|
||
names_key = { 'edate': 'endDate', | ||
'sdate': 'startDate', | ||
'info': 'explanation', | ||
'title': 'cultureName' } | ||
|
||
def getJson(url): | ||
get_data = requests.get(url) | ||
xpars = xmltodict.parse(get_data.text) | ||
jsonDump = json.dumps(xpars) | ||
jsonBody = json.loads(jsonDump) | ||
return jsonBody | ||
|
||
def rename(Body): | ||
final = Body['rfcOpenApi']['body']['data']['list'] | ||
for row in final: | ||
for k, v in names_key.items(): | ||
for old_name in row: | ||
if k == old_name: | ||
row[v] = row.pop(old_name) | ||
return final | ||
|
||
def save(data): | ||
json.dump(data, file, indent=4, ensure_ascii=False) | ||
|
||
|
||
for i in range(0, 61): | ||
queryString = "?" + urlencode({ | ||
"ServiceKey" : unquote("### your key ###"), | ||
"pageNo" : i, | ||
"numOfRows" : 10 | ||
}) | ||
|
||
body = getJson(apiUrl+queryString) | ||
result = rename(body) | ||
save(result) | ||
|
||
file.close() | ||
|
||
|
||
|
Oops, something went wrong.