[問題] Python3 request問題
大家好~~
我的程式碼非常容易,但是實在找不到問題,想請大大們幫忙
這段程式碼如下
這段程式碼可以使用
import requests
req = requests.session()
req.get('http://mis.twse.com.tw/stock/index.jsp') # get cookie
response = req.get('http://mis.twse.com.tw/stock/api/getStockInfo.jsp?_=1516602174329&ex_ch=tse_2330.tw')
print(response.text)
但是我將程式碼第四行,更換成
response = req.get('http://mis.twse.com.tw/stock/api/getStockInfo.jsp?_=1516602174329&ex_ch=tse_2330.tw|tse_1101.tw')
也就是網址列最後方多加了"|tse_1101.tw"之後便不能夠使用了...
想請問大大們是不是因為符號"|"的問題呢? 以及該如何解決?
BTW,這兩個網址,我用瀏覽器載入都是沒有問題的,不知道大大們有遇到這種問題過嗎?
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 140.123.122.127
※ 文章網址: https://www.ptt.cc/bbs/Python/M.1516604272.A.280.html
※ 編輯: GGHOWIN (140.123.122.127), 01/22/2018 15:01:47
※ 編輯: GGHOWIN (140.123.122.127), 01/22/2018 15:04:20
※ 編輯: GGHOWIN (140.123.122.127), 01/22/2018 15:05:38
→
01/22 15:47,
7年前
, 1F
01/22 15:47, 1F
推
01/22 17:04,
7年前
, 2F
01/22 17:04, 2F
→
01/22 17:18,
7年前
, 3F
01/22 17:18, 3F
→
01/22 17:19,
7年前
, 4F
01/22 17:19, 4F
→
01/22 17:20,
7年前
, 5F
01/22 17:20, 5F
推
01/23 00:11,
7年前
, 6F
01/23 00:11, 6F
→
01/23 09:06,
7年前
, 7F
01/23 09:06, 7F
→
01/23 09:07,
7年前
, 8F
01/23 09:07, 8F
→
01/23 09:45,
7年前
, 9F
01/23 09:45, 9F
→
01/24 13:53,
7年前
, 10F
01/24 13:53, 10F
→
01/24 13:54,
7年前
, 11F
01/24 13:54, 11F
→
01/24 13:54,
7年前
, 12F
01/24 13:54, 12F
→
01/24 14:02,
7年前
, 13F
01/24 14:02, 13F
→
01/24 14:02,
7年前
, 14F
01/24 14:02, 14F
Python 近期熱門文章
PTT數位生活區 即時熱門文章