Requestsを使った時のメモ
コード
import requests
url = 'http://www.ekidata.jp/api/s/1130224.xml'
res = requests.get(url)
# 日本語文字化け対応
res.encoding = res.apparent_encoding
print(res.text)
出力結果
<?xml version="1.0" encoding="UTF-8"?>
<ekidata version="ekidata.jp station api 1.0">
<station>
<pref_cd>13</pref_cd>
<line_cd>11302</line_cd>
<line_name>JR山手線</line_name>
<station_cd>1130224</station_cd>
<station_g_cd>1130101</station_g_cd>
<station_name>東京</station_name>
<lon>139.766103</lon>
<lat>35.681391</lat>
</station>
</ekidata>