解决requests.exceptions.MissingSchema: Invalid URL ‘xxx‘: No schema supplied. Perhaps you meant“xxx”

简介: 解决requests.exceptions.MissingSchema: Invalid URL ‘xxx‘: No schema supplied. Perhaps you meant“xxx”

在使用requests请求接口的时候有时候会爆出个这样的问题,问题的大概意思是无效的url,也就是说这个url是没有效果是错误的,这就就要检查一下url是否符合规定,是否少加了协议


import requests
a=requests.get(url="www.baidu.com")   #缺少协议,这样请求会报错
print(a.json())
b=requests.get(url="http://www.baidu.com")   #加入协议后就能正确访问
print(b.json())
相关文章
|
3月前
|
安全 网络安全 API
7-8|requests.exceptions.SSLError: HTTPSConnectionPool(host='jumps.xxx.cn', port=443): Max ret
7-8|requests.exceptions.SSLError: HTTPSConnectionPool(host='jumps.xxx.cn', port=443): Max ret
|
5月前
The requested URL could not be retrieved
The requested URL could not be retrieved
76 1
|
5月前
|
前端开发 安全 测试技术
【Python】已解决:The method is not allowed for the requested URL.
【Python】已解决:The method is not allowed for the requested URL.
523 3
|
数据安全/隐私保护 Python
解决CondaHTTPError:HTTP 000 CONNECTION FAILED for url<https://mirrors.tuna.tsinghua.edu.cn/anaconda***
今天做项目的时候,Python导入一个包一直有各类问题,而后最终锁定问题是CondaHTTPError:HTTP 000 CONNECTION FAILED for url<https://mirrors.tuna.tsinghua.edu.cn/anaconda*** 这就是清华的源出问题了,配置没配对。
解决CondaHTTPError:HTTP 000 CONNECTION FAILED for url<https://mirrors.tuna.tsinghua.edu.cn/anaconda***
|
7月前
|
监控 安全 网络安全
Failed password for invalid user www from xx.xx.xx.xxx port xxxxx ssh2 问题处理
【5月更文挑战第6天】Failed password for invalid user www from xx.xx.xx.xxx port xxxxx ssh2 问题处理
784 1
|
7月前
|
安全 应用服务中间件 网络安全
ebSocket connection to ‘wss://xxx.xxxxxxx.xxx/‘ failed:
ebSocket connection to ‘wss://xxx.xxxxxxx.xxx/‘ failed:
317 0
|
域名解析
访问 URL 报错 500 Internal Privoxy Error
访问 URL 报错 500 Internal Privoxy Error
1333 0
|
安全 网络协议 Ubuntu
解决CondaHTTPError: HTTP 000 CONNECTION FAILED for url <https://mirrors.tuna.tsinghua.edu.cn/anaconda/
解决CondaHTTPError: HTTP 000 CONNECTION FAILED for url <https://mirrors.tuna.tsinghua.edu.cn/anaconda/
2512 0
HttpMessageNotReadableException: Required request body is missing: xxx.controller.login(xxx)...
HttpMessageNotReadableException: Required request body is missing: xxx.controller.login(xxx)...
HttpMessageNotReadableException: Required request body is missing: xxx.controller.login(xxx)...
成功解决404 Not Found Not Found The requested URL was not found on the server. If yo
成功解决404 Not Found Not Found The requested URL was not found on the server. If yo