使用ip,port,path的Python3.4 HTTP连接

时间:2017-04-21 09:15:39

标签: python python-3.x http

我试图建立一个HTTP连接,但得到错误:

  

“http.client.InvalidURL:数字端口:'80 / test / path'

代码:

Import http.client

self.conn = http.client.HTTPConnection("192.168.1.1:80/test/path") #"[ip]/[path],[port] does'nt work either

# some post and put requests

工作代码:

Import requests

requests.post('192.168.1.1:80/test/path',data='testdata')

如何使用ip,port和path建立HTTP连接?

0 个答案:

没有答案