-
Notifications
You must be signed in to change notification settings - Fork 95
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 #38 from WooilJeong/develop
update: 국세청 사업자등록정보 진위확인 및 상태조회 서비스 추가
- Loading branch information
Showing
10 changed files
with
625 additions
and
101 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,77 @@ | ||
import requests | ||
import pandas as pd | ||
|
||
|
||
class Nts: | ||
""" | ||
NTS Open API 클래스 | ||
""" | ||
|
||
def __init__(self, serviceKey=None): | ||
self.serviceKey = serviceKey | ||
self.url_dict = { | ||
"진위확인": "https://api.odcloud.kr/api/nts-businessman/v1/validate", | ||
"상태조회": "https://api.odcloud.kr/api/nts-businessman/v1/status", | ||
} | ||
|
||
def validate(self, businesses): | ||
""" | ||
사업자등록정보 진위확인 API | ||
Parameters | ||
---------- | ||
businesses : list, DataFrame | ||
사업자등록정보 리스트 (1회 호출 시 최대 100개까지 조회 가능) | ||
Returns | ||
------- | ||
DataFrame | ||
진위확인 결과 | ||
""" | ||
url = self.url_dict["진위확인"] | ||
params = { | ||
"serviceKey": self.serviceKey, | ||
} | ||
if type(businesses) == pd.DataFrame: | ||
businesses = businesses.to_dict("records") | ||
json_data = { | ||
"businesses": businesses, | ||
} | ||
try: | ||
response = requests.post(url, params=params, json=json_data) | ||
df = pd.json_normalize(response.json()['data']) | ||
except Exception as e: | ||
print("Error") | ||
print(e) | ||
return | ||
return df | ||
|
||
def status(self, b_no): | ||
""" | ||
사업자등록정보 상태조회 API | ||
Parameters | ||
---------- | ||
b_no : list | ||
사업자등록번호 (1회 호출 시 최대 100개까지 조회 가능) | ||
Returns | ||
------- | ||
DataFrame | ||
상태조회 결과 | ||
""" | ||
url = self.url_dict["상태조회"] | ||
params = { | ||
"serviceKey": self.serviceKey, | ||
} | ||
data = { | ||
"b_no": b_no, | ||
} | ||
try: | ||
response = requests.post(url, params=params, json=data) | ||
df = pd.DataFrame(response.json()['data']) | ||
except Exception as e: | ||
print("Error") | ||
print(e) | ||
return | ||
return df |
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
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
__version__ = "1.0.5" | ||
__version__ = "1.0.6" | ||
__author__ = "정우일(Wooil Jeong)" | ||
__contact__ = "[email protected]" | ||
__github__ = "https://github.com/WooilJeong/PublicDataReader" |
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
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
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
Oops, something went wrong.