Python~ValueError: URL must include a ‘scheme‘, ‘host‘, and ‘port‘ component

这篇具有很好参考价值的文章主要介绍了Python~ValueError: URL must include a ‘scheme‘, ‘host‘, and ‘port‘ component。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

报错截图

Python~ValueError: URL must include a ‘scheme‘, ‘host‘, and ‘port‘ component,Error & Warring,elasticsearch,大数据,搜索引擎

报错代码

from elasticsearch import Elasticsearch

es = Elasticsearch(hosts="192.168.0.76")

报错原因

python使用ElasticSearch库连接elasticsearch的时候url不符合格式,是elasticsearch库版本的原因,ElasticSearch==7.14.0以上的版本不支持这样的连接方法

解决方案

方案一:修改连接的url

在host中添加http://文章来源地址https://www.toymoban.com/news/detail-523930.html

from elasticsearch import Elasticsearch

es = Elasticsearch(hosts="http://192.168.0.76:9200")

方案二:将ElasticSearch库卸载重装低版本

# 卸载原elasticsearch库
pip uninstall elasticsearch
# 安装7.13.0版本的elasticsearch库
pip install elasticsearch==7.13.0

到了这里,关于Python~ValueError: URL must include a ‘scheme‘, ‘host‘, and ‘port‘ component的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • 解决:requests.exceptions.SSLError: HTTPSConnectionPool(host=‘x‘,port=x): Max retries exceeded with url

    在使用selenium操作Chrome浏览器报错:requests.exceptions.SSLError: HTTPSConnectionPool(host=‘lv-pc-api-sinfonlineb.ulikecam.com’, port=443): Max retries exceeded with url: /get (Caused by SSLError(SSLError(1, ‘[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1123)’))) 报错信息如下: 报错截图如下: 主要报错信息内容

    2024年02月21日
    浏览(30)
  • postman 请求接口返回 Bad Request This combination of host and port requires TLS.

    接手一个新项目,下载下来之后,启动一切正常但是访问一直报错,于是在网上查找解决方案,开始说是http改为https 结果postman直接报错了(下图),提示:SSL错误:主机名/IP与证书的别名不匹配 当时没有注意,其实只要点击一下这个红字就自动把ssl证书验证关了。 后来又百

    2024年02月11日
    浏览(63)
  • python selenium报错ValueError: Timeout value connect was <...>, but it must be an int, float or None.

    因更换系统,重新安装了selenium。命令:pip install selenium 默认版本为selenium4,版本不太兼容,所以卸载:pip uninstall selenium 更换为旧版本:pip install selenium==3.141.0 安装完以后显示: Successfully installed selenium-3.141.0 urllib3-2.0.2(坑出现了) 运行一下代码以后报错: 报错: ValueErr

    2024年02月12日
    浏览(32)
  • 解决:python+appium报错ValueError: Timeout value connect was <...>, but it must be an int, float or None.

    pip install --force-reinstall -v \\\"selenium==4.8.0\\\" 参考: python - Running an keyword on Robotframework throw an error: ValueError: Timeout value connect was object object at 0x106cc5b50 - Stack Overflow ValueError: Timeout value connect was object object at 0x7f7515f84420, but it must be an int, float or None. · Issue #863 · appium/python-client

    2024年02月11日
    浏览(65)
  • Python中无法使用Selenium,显示ValueError: Timeout value connect was ……, but it must be an int, float or None

           近期重装了系统,需要做个爬虫,最初想用Selenium和Msedge模拟浏览器操作,但总是不成功,即使是用webdriver打开网页这样最简单的操作,也无法做到,总是显示ValueError: Timeout value connect was object object at 0x……, but it must be an int, float or None。       怀疑是设置问题,将对

    2024年02月16日
    浏览(29)
  • Nginx+Springboot配置https后的scheme和port问题

    反向代理:Nginx (nginx version: nginx/1.14.2) 网关:Zuul (2.2.9.RELEASE) 服务:SpringBoot使用内置Tomcat (9.0.71) Nginx:设置请求头,向后面的代理或服务传递真实的协议、域名(ip)、端口 Zuul SpringBoot 3.1.request.getScheme()获取的是http 1.确认Nginx配置:proxy_set_header X-Forwarded-Proto $scheme;

    2024年01月19日
    浏览(24)
  • iOS 常用应用的url scheme

    应用 连接地址 id url scheme 微信 ‎App Store 上的“微信” 414478124 weixin:// 淘宝 https://itunes.apple.com/cn/app/id387682726?mt=8 387682726 taobao:// QQ https://itunes.apple.com/cn/app/id444934666?mt=8 444934666 mqq:// 百度 https://itunes.apple.com/cn/app/id382201985?mt=8 382201985 BaiduSSO:// 墨迹天气 https://itunes.apple.com/cn/ap

    2024年02月04日
    浏览(28)
  • 生成微信小程序码、URL Scheme和URL Link

    通用第一步,获取access_token,需要服务端去获取并缓存 (APPID和APPSECRET在微信小程序后台查看获取) 1.获取小程序码( 通过该接口生成的小程序码,永久有效,数量暂无限制 ) 2.获取URL Scheme( 通过该接口生成的Scheme ,只有30天有效期 )(iOS可以直接跳,安卓需要适配weixin://xxx这种协议头

    2024年02月12日
    浏览(38)
  • Python代理IP异常:requests.exceptions.ProxyError: HTTPSConnectionPool(host=‘xxxx‘, port=443)

            这是我在使用Python爬取网页信息的时候出现的异常。         由于很多要爬取的网站会把“IP限制”作为反爬虫手段,所以我偶尔会使用“代理IP服务器”去处理相关需求,因为我觉得每次都 time.sleep(10) 太漫长,对频繁且大量的请求十分不友好。         推荐代理

    2024年02月03日
    浏览(28)
  • springboot 跳转微信小程序 生成URL Scheme URL Link

            通过微信文档中的URL link或URL Scheme方式生成,更多事项细节见官方文档 话不多说,直接上代码

    2024年02月08日
    浏览(42)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包