FAQ Database Discussion Community


What is the best way to use HTTP Keep-Alive in Python 2.7 [duplicate]

python,http,urllib2,keep-alive
This question already has an answer here: Python urllib2 with keep alive 7 answers There are several options to use Keep-Alive. I'm trying to use urllib2 to use Keep-Alive, but it doesn't officially support it in Python 2.7. I heard pycurl had the funciton. That's why I'm here to...

Request multiple pages on some site useing one connection with python requests

python,python-2.7,python-requests,keep-alive
I want to parse multiple (about 180) pages from one site. In python i'm doing like this: def myFunc(pages): forreturn=[] session=requests.session() for page in pages: #List, containing page addresses url = 'http://example.com/' + page # we get something like 'http://example.com/sub1/page.html' # Ant the part with "sub1" is different each time....

WebSphere MQ DISC vs KAINT on SVRCONN channels

websphere-mq,channel,keep-alive
we have a major problem with many of our Applications making improper connections (SVRCONN) with queue manager and not issuing MQDISC when connection not required. This causes lot of idle stale connections and prevents Application from making new connections and fails with CONNECTION BROKEN (2009) error. We have been restricting...

How to configure Jersey (javax.ws.rs.*) to reuse ssl sessions

java,ssl,jax-rs,jersey-2.0,keep-alive
I have written a test client that sends requests over TLS using the Jersey library. I am having a hard time trying to figure out how to configure/code the Jersey client such that it reuses the SSL sessions so that I could make my tests faster. The Jersey client by...

Curl TCP keepalives on mac

sockets,curl,tcp,keep-alive
I have multiple servers set up under a load balancer that distributes requests to them by TCP connection. In other words - if I issue many requests in the browser all of them will be sent to one of the servers that are under load balancer as the TCP connection...

Persistent connection not working at all

html,http,tcp,scapy,keep-alive
I am making a webserver with scapy, which is going pretty well. However, it's a pain in the butt for scapy to maintain different connections at the same time. So I want the client to make a persistent connection with the webserver that servers a html page with an image....

Reusing connections in Django with Python Requests

python,django,python-requests,connection-pooling,keep-alive
What's the correct way of reusing Python Requests connections in Django across multiple HTTP requests. That's what I'm doing currently: import requests def do_request(data): return requests.get('http://foo.bar/', data=data, timeout=4) def my_view1(request) req = do_request({x: 1}) ... def my_view2(request) req = do_request({y: 2}) ... So, I have one function that makes the...