Last active
March 20, 2021 11:36
-
-
Save imrexhuang/1423e74fe72838f4660cabaf32f94ce6 to your computer and use it in GitHub Desktop.
Python取得公開資訊觀測站的重大訊息公告(無法正常使用)
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
| # ※此版本會被證交所主機擋,無法正常使用,僅供示範※ | |
| # 請先pip install beautifulsoup4 | |
| # https://rexpyblog.blogspot.com/2021/03/html.html 文章範例程式 | |
| import requests | |
| from bs4 import BeautifulSoup | |
| headers = {'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36'} | |
| # 公開資訊觀測站的重大訊息公告 | |
| url = 'https://mops.twse.com.tw/mops/web/ajax_t05st01?firstin=1&TYPEK=sii&co_id=2330&year=107&month=&b_date=&e_date=' | |
| res = requests.get(url, headers=headers).text | |
| print(res) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment