简体   繁体   中英

python-requests, use earlier socket

Can I use socket/earlier created connection with python-requests? I don't want to waste time to make new connection to server, I just want to send another POST request,

 session.post( Url, background_callback=searchCallback,
     background_callback_args=(extraArgs,), data=' ', headers=searchHeaders,
     verify=False, timeout=0.3)

and then in my callback something like this

session.getSocket().POST( ARGS )

So

def searchCallback( session, response ):
    session.post( newUrl, data=postData )

will use earlier socket and won't create new one because it will be using the same [connection to server isn't closed]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM