Skip to content
This repository was archived by the owner on Aug 30, 2024. It is now read-only.

Commit 54d8fbe

Browse files
committed
Remove session endpoint checks
These checks are redundant. Session endpoint requests are always made using the base request method.
1 parent c115f9c commit 54d8fbe

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

src/cloudant/_common_util.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@
2424
import json
2525
from requests import RequestException, Session
2626

27-
from ._2to3 import LONGTYPE, STRTYPE, NONETYPE, UNITYPE, iteritems_, url_parse, \
28-
url_join
27+
from ._2to3 import LONGTYPE, STRTYPE, NONETYPE, UNITYPE, iteritems_, url_join
2928
from .error import CloudantArgumentError, CloudantException
3029

3130
# Library Constants
@@ -356,10 +355,7 @@ def request(self, method, url, **kwargs): # pylint: disable=W0221
356355
"""
357356
resp = super(CookieSession, self).request(method, url, **kwargs)
358357

359-
path = url_parse(url).path.lower()
360-
post_to_session = method.upper() == 'POST' and path == '/_session'
361-
362-
if not self._auto_renew or post_to_session:
358+
if not self._auto_renew:
363359
return resp
364360

365361
is_expired = any((
@@ -431,7 +427,7 @@ def request(self, method, url, **kwargs): # pylint: disable=W0221
431427

432428
resp = super(IAMSession, self).request(method, url, **kwargs)
433429

434-
if not self._auto_renew or url in [self._session_url, self._token_url]:
430+
if not self._auto_renew:
435431
return resp
436432

437433
if resp.status_code == 401:

0 commit comments

Comments
 (0)