summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Pursehouse <david.pursehouse@sonymobile.com>2015-06-29 10:15:45 +0900
committerDavid Pursehouse <david.pursehouse@sonymobile.com>2015-06-29 10:17:57 +0900
commit964bed0993f1f01bd9eb5746ef26c089ad2a4369 (patch)
tree0988df315620d0a93eca078832386886dbcc747d
parente9a3a9bddd827a3f78343862ca397452e53d3f25 (diff)
downloadpygerrit-964bed0993f1f01bd9eb5746ef26c089ad2a4369.tar.gz
Don't use requests.session()0.2.10
Workaround for requests issue 2409 [1] and Gerrit issue 3458 [2] where the Gerrit server returns HTTP 400 on subsequent requests via an existing session. [1] https://github.com/kennethreitz/requests/issues/2409 [2] http://code.google.com/p/gerrit/issues/detail?id=3458 Change-Id: I98428ec59fca7146c5587172b464e2e09b90782c
-rw-r--r--pygerrit/rest/__init__.py9
1 files changed, 4 insertions, 5 deletions
diff --git a/pygerrit/rest/__init__.py b/pygerrit/rest/__init__.py
index 2c80313..31e5b3e 100644
--- a/pygerrit/rest/__init__.py
+++ b/pygerrit/rest/__init__.py
@@ -73,7 +73,6 @@ class GerritRestAPI(object):
'verify': verify,
'headers': headers}
self.url = url.rstrip('/')
- self.session = requests.session()
if auth:
if not isinstance(auth, requests.auth.AuthBase):
@@ -115,7 +114,7 @@ class GerritRestAPI(object):
"""
kwargs.update(self.kwargs.copy())
- response = self.session.get(self.make_url(endpoint), **kwargs)
+ response = requests.get(self.make_url(endpoint), **kwargs)
return _decode_response(response)
def put(self, endpoint, **kwargs):
@@ -134,7 +133,7 @@ class GerritRestAPI(object):
if "data" in kwargs:
kwargs["headers"].update(
{"Content-Type": "application/json;charset=UTF-8"})
- response = self.session.put(self.make_url(endpoint), **kwargs)
+ response = requests.put(self.make_url(endpoint), **kwargs)
return _decode_response(response)
def post(self, endpoint, **kwargs):
@@ -153,7 +152,7 @@ class GerritRestAPI(object):
if "data" in kwargs:
kwargs["headers"].update(
{"Content-Type": "application/json;charset=UTF-8"})
- response = self.session.post(self.make_url(endpoint), **kwargs)
+ response = requests.post(self.make_url(endpoint), **kwargs)
return _decode_response(response)
def delete(self, endpoint, **kwargs):
@@ -169,7 +168,7 @@ class GerritRestAPI(object):
"""
kwargs.update(self.kwargs.copy())
- response = self.session.delete(self.make_url(endpoint), **kwargs)
+ response = requests.delete(self.make_url(endpoint), **kwargs)
return _decode_response(response)
def review(self, change_id, revision, review):