Fixed issue with auth
authorSybren A. Stüvel <sybren@stuvel.eu>
Fri, 3 Nov 2017 12:41:00 +0000 (13:41 +0100)
committerSybren A. Stüvel <sybren@stuvel.eu>
Fri, 3 Nov 2017 12:41:00 +0000 (13:41 +0100)
Apparently setting session.auth doesn't work as I expected it to work.

svnman/remote.py

index cf6438e..78d1503 100644 (file)
@@ -32,9 +32,6 @@ class Remote(object):
 
     def __attrs_post_init__(self):
         from requests.adapters import HTTPAdapter
-
-        if self.username or self.password:
-            self._session.auth = (self.username, self.password)
         self._session.mount('/', HTTPAdapter(max_retries=10))
 
     def fetch_repo(self, repo_id: str) -> RepoDescription:
@@ -51,4 +48,6 @@ class Remote(object):
 
         abs_url = urljoin(self.remote_url, rel_url)
         self._log.getChild('request').info('%s %s', method, abs_url)
-        return self._session.request(method, abs_url, **kwargs)
+
+        auth = (self.username, self.password) if self.username or self.password else None
+        return self._session.request(method, abs_url, auth=auth, **kwargs)