문제

As I read the sample code, I first need to open and connection

conn = httplib.HTTPSConnection(server)

and then I can send multiple requests without making a new connection:

 conn.request(...)

So does it mean that I have a persistent connection ? Or httplib will make a new connection every request ? How to ensure a persistent connection with httplib ?

도움이 되었습니까?

해결책

No. Your best bet is httplib2.

다른 팁

Yes, the connection is persistent, assuming the server supports it. In the first example, you can verify that the connection sock attribute is reused. Note the response has to be closed, e.g. read(), each time as well.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top