|
27 |
# /usr/share/common-licenses/AGPL-3; if not, see |
27 |
# /usr/share/common-licenses/AGPL-3; if not, see |
28 |
# <http://www.gnu.org/licenses/>. |
28 |
# <http://www.gnu.org/licenses/>. |
29 |
|
29 |
|
|
|
30 |
import socket |
30 |
import time |
31 |
import time |
31 |
from collections import defaultdict |
32 |
from collections import defaultdict |
32 |
from datetime import datetime |
33 |
from datetime import datetime |
|
202 |
|
203 |
|
203 |
def ping(self, host=None): # type: (Optional[str]) -> bool |
204 |
def ping(self, host=None): # type: (Optional[str]) -> bool |
204 |
host = host if host else self._default_host |
205 |
host = host if host else self._default_host |
205 |
try: |
206 |
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as veyon_socket: |
206 |
result = requests.get( |
207 |
veyon_socket.settimeout(self._ping_timeout) |
207 |
"{}/authentication/{}".format(self._url, host), timeout=self._ping_timeout |
208 |
return veyon_socket.connect_ex((host, 11100)) == 0 |
208 |
) |
|
|
209 |
return result.status_code == 200 |
210 |
except requests.ReadTimeout: |
211 |
return False |
212 |
|
209 |
|
213 |
def set_feature(self, feature, host=None, active=True, arguments=None): |
210 |
def set_feature(self, feature, host=None, active=True, arguments=None): |
214 |
# type: (Feature, Optional[str], Optional[bool], Optional[Dict[str, str]]) -> None |
211 |
# type: (Feature, Optional[str], Optional[bool], Optional[Dict[str, str]]) -> None |
215 |
- |
|
|