import json
import urllib2
url = "https://TARGET.URL"
data = json.load(urllib2.urlopen(url))
import requests
import bs4
import json
--------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------
HOW TO USE
import fxrate
fxrate.usd()
--------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------
res = requests.get('https://www.koreaexim.go.kr/site/program/financial/exchangeJSON?authkey=AUTHKEY1234567890&searchdate=20200529&data=AP01')
res.raise_for_status()
#res.encoding='euc-kr'
html = res.text
data = json.loads(html)
def usd():
# weather = weatherlist
for i in data:
if i['cur_unit'] == 'USD':
usd = i["deal_bas_r"]
break
return usd
--------------------------------------------------------------------------------------------------------
'Computer > Programing' 카테고리의 다른 글
VS CODE (0) | 2020.03.01 |
---|---|
Send image file to Telegram (0) | 2019.03.18 |
Clien login python 클리앙 로그인 파이썬 (0) | 2019.02.07 |
Python data structure 파이썬 자료구조 (0) | 2019.02.07 |
Telegram URL 이용하여 문자 보내는법 (0) | 2019.02.07 |
Python 실행값을 PHP로 불러오기 (0) | 2019.02.07 |
Parsing - Python (0) | 2019.02.07 |
텍스트 분석 후 특정파일만 출력 (0) | 2019.02.07 |