address double slash issue

This commit is contained in:
shim_ 2018-10-04 17:05:50 +02:00
parent 48c89f2c71
commit 70e7814894

View File

@ -12,7 +12,7 @@ class SeafileClient:
self.login = (username,password) self.login = (username,password)
def api_endpoint(self): def api_endpoint(self):
return "%s/api2/" % self.server return "%s/api2" % self.server
def ping(self,auth=False): def ping(self,auth=False):
try: try:
@ -24,7 +24,7 @@ class SeafileClient:
def obtain_token(self): def obtain_token(self):
user,passw = self.login user,passw = self.login
try: try:
req=self.session.post("%s/auth-token/" % self.api_endpoint(), data = {'username': user, 'password': passw }) req=requests.post("%s/auth-token/" % self.api_endpoint(), data = {'username': user, 'password': passw })
json = req.json() json = req.json()
if "non_field_errors" in json: if "non_field_errors" in json:
print(json["non_field_errors"]) print(json["non_field_errors"])