|

楼主 |
发表于 2020-6-18 12:59:56
|
显示全部楼层
还有一个问题,为什么我用User_agent 传入http协议的返回成功 https却失败了啊
- html = Use_agent('http://jandan.net/ooxx').decode('utf-8')
- print(html)
复制代码- html = Use_agent('https://www.7yip.cn/free/?action=china&page=1').decode('utf-8')
- print(html)
复制代码
后一个报错:
Traceback (most recent call last):
File "C:\Users\Shura\Desktop\python\OOXX\爬虫之IP代理.py", line 46, in <module>
html = Use_agent('https://www.7yip.cn/free/?action=china&page=1').decode('utf-8')
File "C:\Users\Shura\Desktop\python\OOXX\爬虫之IP代理.py", line 42, in Use_agent
return urllib.request.urlopen(req).read()
File "C:\Users\Shura\AppData\Local\Programs\Python\Python38\lib\urllib\request.py", line 222, in urlopen
return opener.open(url, data, timeout)
File "C:\Users\Shura\AppData\Local\Programs\Python\Python38\lib\urllib\request.py", line 525, in open
response = self._open(req, data)
File "C:\Users\Shura\AppData\Local\Programs\Python\Python38\lib\urllib\request.py", line 542, in _open
result = self._call_chain(self.handle_open, protocol, protocol +
File "C:\Users\Shura\AppData\Local\Programs\Python\Python38\lib\urllib\request.py", line 502, in _call_chain
result = func(*args)
File "C:\Users\Shura\AppData\Local\Programs\Python\Python38\lib\urllib\request.py", line 806, in <lambda>
meth(r, proxy, type))
File "C:\Users\Shura\AppData\Local\Programs\Python\Python38\lib\urllib\request.py", line 810, in proxy_open
proxy_type, user, password, hostport = _parse_proxy(proxy)
File "C:\Users\Shura\AppData\Local\Programs\Python\Python38\lib\urllib\request.py", line 771, in _parse_proxy
scheme, r_scheme = _splittype(proxy)
File "C:\Users\Shura\AppData\Local\Programs\Python\Python38\lib\urllib\parse.py", line 1008, in _splittype
match = _typeprog.match(url)
TypeError: expected string or bytes-like object |
|