January 2019
Beginner to intermediate
776 pages
19h 58m
English
Here's the code for installing a Python package using Fabric.
Listing 6.4 gives the code for installing a Python package remotely as follows:
#!/usr/bin/env python
# Python Network Programming Cookbook, Second Edition -- Chapter - 6
# This program is optimized for Python 2.7.12 and Python 3.5.2.
# It may run on any other version with/without modifications.
from getpass import getpass
from fabric.api import settings, run, env, prompt
def remote_server():
env.hosts = ['127.0.0.1']
env.user = prompt('Enter user name: ')
env.password = getpass('Enter password: ')
def install_package():
run("pip install yolk")
Fabric scripts are run in a different way as compared to the normal Python scripts. All functions using the fabric library ...
Read now
Unlock full access