解决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())
相关文章
|
4月前
|
监控 安全 网络安全
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 问题处理
428 1
|
4月前
|
缓存 JavaScript
报错:cannot read properties of undefined “reading url“
报错:cannot read properties of undefined “reading url“
123 6
|
4月前
|
安全 应用服务中间件 网络安全
ebSocket connection to ‘wss://xxx.xxxxxxx.xxx/‘ failed:
ebSocket connection to ‘wss://xxx.xxxxxxx.xxx/‘ failed:
200 0
|
11月前
|
Java
【Java异常】feign.FeignException: status 400 reading xxx#xxxx(String); content:
【Java异常】feign.FeignException: status 400 reading xxx#xxxx(String); content:
52 0
|
域名解析
访问 URL 报错 500 Internal Privoxy Error
访问 URL 报错 500 Internal Privoxy Error
927 0
|
IDE Java 开发工具
Idea 启动报错 failed to create jvmjvm path url或failed to create jvmerror code -1 jvm path
Idea 启动报错 failed to create jvmjvm path url或failed to create jvmerror code -1 jvm path
128 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)...
|
缓存 Java 应用服务中间件
SpringBoot文件上传异常之提示The temporary upload location xxx is not valid
SpringBoot搭建的应用,一直工作得好好的,突然发现上传文件失败,提示org.springframework.web.multipart.MultipartException: Failed to parse multipart servlet request; nested exception is java.io.IOException: The temporary upload location [/tmp/tomcat.6239989728636105816.19530/work/Tomcat/localhost/ROOT] is not valid目录非法
600 0
SpringBoot文件上传异常之提示The temporary upload location xxx is not valid
成功解决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
|
对象存储
上传文件到OSS报错:[Server]Unable to execute HTTP request: Position is not equal to file length
上传文件到OSS报错:[Server]Unable to execute HTTP request: Position is not equal to file length
1116 0