mirror of
https://github.com/uroni/urbackup-server-python-web-api-wrapper.git
synced 2025-10-26 11:38:16 +00:00
Merge pull request #14 from FreedomNetNL/feature/add-client-with-group
Feature: Add client with group
This commit is contained in:
commit
2f9c6697cc
3
.gitignore
vendored
3
.gitignore
vendored
@ -1,3 +1,6 @@
|
|||||||
urbackup_server_web_api_wrapper.egg-info/*
|
urbackup_server_web_api_wrapper.egg-info/*
|
||||||
dist/urbackup-server-web-api-wrapper-*.zip
|
dist/urbackup-server-web-api-wrapper-*.zip
|
||||||
urbackup_api/__pycache__/*
|
urbackup_api/__pycache__/*
|
||||||
|
|
||||||
|
# IDE
|
||||||
|
.idea
|
||||||
|
|||||||
@ -4,9 +4,7 @@ from urllib.parse import urlparse
|
|||||||
from urllib.parse import urlencode
|
from urllib.parse import urlencode
|
||||||
from base64 import b64encode
|
from base64 import b64encode
|
||||||
import hashlib
|
import hashlib
|
||||||
import socket
|
|
||||||
import shutil
|
import shutil
|
||||||
import os
|
|
||||||
import binascii
|
import binascii
|
||||||
import logging
|
import logging
|
||||||
from enum import Enum
|
from enum import Enum
|
||||||
@ -220,12 +218,15 @@ class urbackup_server:
|
|||||||
"os": e_installer_os.value
|
"os": e_installer_os.value
|
||||||
})
|
})
|
||||||
|
|
||||||
def add_client(self, clientname):
|
def add_client(self, clientname, groupname=None):
|
||||||
|
|
||||||
if not self.login():
|
if not self.login():
|
||||||
return None
|
return None
|
||||||
|
|
||||||
ret = self._get_json("add_client", {"clientname": clientname})
|
data = {"clientname": clientname}
|
||||||
|
if groupname is not None:
|
||||||
|
data['group_name'] = groupname
|
||||||
|
|
||||||
|
ret = self._get_json("add_client", data)
|
||||||
if ret == None or "already_exists" in ret:
|
if ret == None or "already_exists" in ret:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user