Created
February 27, 2017 06:38
-
-
Save Asoul/541ff860332de92ef586156ac0cb480e to your computer and use it in GitHub Desktop.
This file contains hidden or 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
import requests | |
import time | |
endpoint = 'http://mis.twse.com.tw/stock/api/getStockInfo.jsp' | |
targets = ['0050'] | |
timestamp = int(time.time() * 1000 + 1000000) | |
channels = '|'.join('tse_{}.tw'.format(target) for target in targets) | |
query_url = '{}?_={}&ex_ch={}'.format(endpoint, timestamp, channels) | |
req = requests.session() | |
req.get('http://mis.twse.com.tw/stock/index.jsp') | |
print(query_url) | |
response = req.get(query_url) | |
print(response.content) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment