К основному контенту

Сообщения

Сообщения за декабрь, 2019

pydecisions — A Python Library of management decision

https://medium.com/@balamurali_m/pydecisions-a-python-library-of-management-decision-making-techniques-f0360adb94a0 pip install pydecisions https://drive.google.com/file/d/1HOVNpIXq0ijlLHESPYIUXORQpEkjZwLU/view?usp=drivesdk

Python remote commands

Выполнение команд/скриптов на удаленных серверах https://rtfm.co.ua/python-modul-fabric/ http://www.fabfile.org или использовать paramico import paramiko res_list = list() i = 0 # counter while True: plpy.notice('Trying to connect to %s (%i from %i times)" % (host_ip, i, retry_time)') try: ssh = paramiko.SSHClient() ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) ssh.connect(hostname=host_ip, port=port, username=username, password=userpass) break except paramiko.AuthenticationException as e: plpy.error('Authentication failed when connecting to %s (%s)' % (host_ip, e.message)) return None except Exception as e: plpy.error("Could not SSH to %s, waiting for it to start (%s)" % (host_ip, str(e))) i += 1 time.sleep(2) # If we could not connect within time limit if i >= retry_time: plpy.error('Could not connect to %s. Giving up' %...

Python requirements

Генерация requirements Python pip/pip3 install pipreqs # https://pypi.org/project/pipreqs/ $ pipreqs /home/project/location Successfully saved requirements file in /home/project/location/requirements.txt После выполнить pip install -r requirements.txt