1

I use requests python module as following:

import requests
from requests.structures import CaseInsensitiveDict
...

response = requests.post(URL, json={ 'a': '123', 'b': '456' })
...

I'm assuming that requests.post above is opening socket, making a connection to the server at url etc. Does it incur lots of overhead? Is it possible with this library to keep HTTP connection always open, and only submit new requests? The reason I'm asking is that I'd like to make HTTP requests in a thread, so I thought if I open a connection in the main thread and simply pass a socket descriptor or some sort of connection handle, then the whole operation would be faster. Please correct me if I'm wrong.

Mark
  • 6,052
  • 8
  • 61
  • 129

0 Answers0