Skip to content

Commit

Permalink
Restored use session in requests
Browse files Browse the repository at this point in the history
  • Loading branch information
Alberto Paro committed Feb 15, 2012
1 parent 57a9b5b commit 36bf782
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pyes/connection_http.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {}
Expand All @@ -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)
Expand Down

0 comments on commit 36bf782

Please sign in to comment.