1

In older versions of Requests there was option to turn off keep alive. Something like this:

s = requests.session()
s.config['keep_alive'] = False

I also find in other question that I can use header Connection: close

HTTP/1.1 defines the "close" connection option for the sender to signal 
that the connection will be closed after completion of the response. 
For example,
   Connection: close
in either the request or the response header fields indicates that the 
connection SHOULD NOT be considered `persistent' (section 8.1) after the 
current request/response is complete.
HTTP/1.1 applications that do not support persistent connections MUST 
include the "close" connection option in every message. 

If I understand this properly it doesn't mean that connection will be closed. It's only information that it shouldn't be considered as persistent one.

How to do it in recent versions?

StKob
  • 61
  • 1
  • 5
  • [Python-Requests (>= 1.*): How to disable keep-alive?](https://stackoverflow.com/questions/21008953/python-requests-1-how-to-disable-keep-alive) – moghya Dec 20 '18 at 14:48
  • I`am also referring in my question to that. But my understanding of 'connection: close' header is different. That's why I had posted this question. – StKob Dec 23 '18 at 12:46

0 Answers0