如何在python中发送没有方案的http请求?

时间:2015-06-19 04:08:42

标签: python

raise InvalidSchema("No connection adapters were found for '%s'" % url)requests.exceptions.InvalidSchema: No connection adapters were found for

当我在python中使用请求模块发送http请求时,这里是回溯:

  <table>
    <tr>
     <td >ID</td>
     <td>Sub</td>
    </tr>
    <tr>
     <td rowspan="3">1</td>
     <td>S1</td>
    </tr>
    <tr>
     <td>S2</td>
    </tr>
    <tr>
     <td>S3</td>
    </tr> 
  </table>

 --------------
  ID  | subjects 
 --------------
      | S1
      --------  
   1  | S2  
      --------
      | S3  
 --------------
      | S4 
      -------- 
   2  | S5  
      --------
      | S6
 --------------

    user:[
    {id:1 , 
     subjects:[
       {id:1 , name:"eng"} 
       {id:2 , name:"phy"}
      ]
     },
    { id:2 , 
     subjects:[
       {id:1 , name:"eng"} 
       {id:3 , name:"math"}
     ]
    }
   ]

1 个答案:

答案 0 :(得分:0)

如果您打算使用HTTP,如问题中所示,那么答案就是“添加HTTP方案”。

使用urlparse轻松检查网址中是否缺少该方案。

对于代理,默认方案现在为http see herehere