I am using the browsermob-proxy to capture traffic from selenium tests. I was making the requests from inside of the robotframework and occasionally got the issue: Connection aborted: Error10061, No connection could be made because the target actively refused it. So I moved all of the requests into python using the requests library but now it consistantly fails on:
def saveHar(self, proxy, name):
server, req = proxy
name +=str(server.harCount) + ".har"
print name
print server, " ", server.url
har = req.put(server.url+"/proxy/11049/har")
print har
print har._content
req being a requests library session and server being the browsermob-proxy server. I am confused as to what is causing this error, I have tried closing the connection and allowing the port in the firewall but it still fails. Any help would be much appreciated!
Fixed it, added a check to make sure the server is listening before I send the request