Skip to content
Browse files

Restored use session in requests

  • Loading branch information...
1 parent 57a9b5b commit 36bf78269d1eec880f5442d88048c1e5be211f52 Alberto Paro committed Feb 15, 2012
Showing with 3 additions and 2 deletions.
  1. +3 −2 pyes/connection_http.py
View
5 pyes/connection_http.py
@@ -29,7 +29,7 @@
class ClientTransport(object):
"""Encapsulation of a client session."""
- def __init__(self, server, framed_transport, timeout, recycle, basic_auth):
+ def __init__(self, server, framed_transport, timeout, recycle, basic_auth=None):
self.connection_type, self.host, self.port = server
self.timeout = timeout
self.headers = {}
@@ -53,7 +53,8 @@ def execute(self, request):
"""
headers = self.headers.copy()
headers.update(request.headers)
- response = requests.request(method=Method._VALUES_TO_NAMES[request.method],
+ s = requests.session()
+ response = s.request(method=Method._VALUES_TO_NAMES[request.method],
url="http://%s:%s%s" % (self.host, self.port, request.uri), params=request.parameters,
data=request.body, headers=request.headers)
return RestResponse(status=response.status_code, body=response.content, headers=response.headers)

0 comments on commit 36bf782

Please sign in to comment.
Something went wrong with that request. Please try again.