Created
November 21, 2020 08:47
-
-
Save tiger1710/96a9f9d459362eeffd6b0640fada1f3b to your computer and use it in GitHub Desktop.
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
from urllib.parse import quote_plus, urlencode | |
import requests | |
from urllib.request import urlopen, Request | |
session = requests.Session | |
url = 'http://apis.data.go.kr/1160100/service/GetStocDiviInfoService/getDiviInfo' | |
queryParams = '?' + urlencode({ | |
quote_plus('ServiceKey') : 'gJzlDCS7IS9dZXyGkrtszUr0x5BophBoSedp7A6TEATYpeG9rzLVB8sOyNKf8kRUWl7cc50has2ogGw9KWGICw%3D%3D', | |
quote_plus('pageNo') : '1', | |
quote_plus('numOfRows') : '10', | |
quote_plus('resultType') : 'xml', | |
quote_plus('basDt') : '', | |
quote_plus('crno') : '1101110057012', | |
quote_plus('stckIssuCmpyNm') : '동남합성' | |
}) | |
req = Request(url + queryParams) | |
req.get_method = lambda: 'GET' | |
response_body = urlopen(req).read().decode('utf-8') | |
print(response_body) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment