【问题标题】:Python Requests Cannot Find Connection AdaptersPython 请求找不到连接适配器
【发布时间】:2016-01-26 18:33:50
【问题描述】:

当我在 Windows8.1 上的 Python3.4 中运行以下代码时:

r = requests.get(url)

它返回,除其他外:

File "C:\Python34\lib\site-packages\requests\sessions.py", line 644, in get_adapter
   raise InvalidSchema("No connection adapters were found for '%s'" % url) requests.exceptions.InvalidSchema: No connection adapters were found for '"http://example.com"'

这仅仅是我的代码、防火墙或其他方面的问题吗?我将如何解决它?

【问题讨论】:

  • 我猜你的网址有问题,网址应该是这样的 - “example.com”,而不是这样的'“example.com”'
  • @minitoto 你的意思是没有引号?可能是,让我检查一下。
  • @minitoto 是的,就是这样(我在某处不正确地实现了 input())。谢谢!

标签: python python-3.x python-requests python-3.4


【解决方案1】:

将您的 get 请求更改为仅使用一种引号:

requests.get("http://example.com")

你试图同时使用两种类型的引号,它给出了一个正确的错误:

requests.get('"http://example.com"')

【讨论】:

    猜你喜欢
    • 2020-07-27
    • 1970-01-01
    • 2013-02-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-09-08
    • 1970-01-01
    相关资源
    最近更新 更多