Skip to content

Commit

Permalink
Merge pull request #71 from jesper-raemaekers/load-balancer-coockies
Browse files Browse the repository at this point in the history
Attempt to pass cookies to other services #61
  • Loading branch information
jesper-raemaekers authored Apr 28, 2022
2 parents f8489f2 + dffa8ad commit ad650ba
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions polarion/polarion.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,13 @@ def _createSession(self):
self.services['Session']['url'] + '?wsdl', plugins=[self.history], transport=self._getTransport())
try:
self.sessionHeaderElement = None
self.sessionCookieJar = None
self.services['Session']['client'].service.logIn(
self.user, self.password)
tree = self.history.last_received['envelope'].getroottree()
self.sessionHeaderElement = tree.find(
'.//{http://ws.polarion.com/session}sessionID')
self.sessionCookieJar = self.services['Session']['client'].transport.session.cookies
except Exception:
raise Exception(
f'Could not log in to Polarion for user {self.user}')
Expand All @@ -110,6 +112,7 @@ def _updateServices(self):
self.services[service]['url'] + '?wsdl', transport=self._getTransport())
self.services[service]['client'].set_default_soapheaders(
[self.sessionHeaderElement])
self.services[service]['client'].transport.session.cookies = self.sessionCookieJar
if service == 'Tracker':
if hasattr(self.services[service]['client'].service, 'addComment'):
# allow addComment to be send without title, needed for reply comments
Expand Down

0 comments on commit ad650ba

Please sign in to comment.