From d8438e13f58ca59aa21f6a0f0f74329c92bca12f Mon Sep 17 00:00:00 2001 From: Maks Snegov Date: Tue, 25 Aug 2020 23:17:58 +0300 Subject: [PATCH] Fix getting seafile server URL --- seafile_client/client.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/seafile_client/client.py b/seafile_client/client.py index 4555429..0dcac48 100644 --- a/seafile_client/client.py +++ b/seafile_client/client.py @@ -2,6 +2,7 @@ import logging import os import subprocess import time +from urllib.parse import urlparse import requests @@ -15,7 +16,8 @@ logging.basicConfig(format="%(asctime)s %(message)s", class SeafileClient: def __init__(self, host: str, user: str, passwd: str): - self.url = requests.get(f"http://{host}").url + up = urlparse(requests.get(f"http://{host}").url) + self.url = f"{up.scheme}://{up.netloc}" self.user = user self.password = passwd self.__token = None