huawei_file_transfer-V0.0.2 huawei_file_transfer-V0.0.2 is a Netmiko-based function that provides file transfer capabilities for Huawei devices
Project description
##huawei_file_transfer huawei_file_transfer is a Netmiko-based function that provides file transfer capabilities for Huawei devices. This function is modified for netmiko==4.2.0, so the version of netmiko needs to be >=4.0.0.At the same time, it provides hidden verification of the available size of the target space and the existence of files This function currently does not support file verification, The parameter of verify needs to be set to False. ###Installing
pip install huawei_file_transfer
##Example Usage ###Using the put of direction
from huawei_file_transfer import file_transfer
from netmiko import ConnectHandler
device_info = {
"device_type": "huawei",
"ip": "192.168.0.253",
"username": "admin123",
"password": "Huawei@123",
}
with ConnectHandler(**device_info) as connect:
print("已经成功登陆设备" + device_info['ip'])
output = file_transfer(
connect,
source_file="s5735-l1-v200r022sph150.pat",
dest_file="s5735-l1-v200r022sph150.pat",
file_system="flash:",
direction="put",
verify_file=False,
overwrite_file=True,
)
print(output)
Results
{'file_exists': True, 'file_transferred': True, 'file_verified': False}
###Using the get of direction
from huawei_file_transfer import file_transfer
from netmiko import ConnectHandler
device_info = {
"device_type": "huawei",
"ip": "192.168.0.253",
"username": "admin123",
"password": "Huawei@123",
}
with ConnectHandler(**device_info) as connect:
print("已经成功登陆设备" + device_info['ip'])
output = file_transfer(
connect,
source_file="s5735-l1-v200r022sph150.pat",
dest_file="s5735-l1-v200r022sph150.pat",
file_system="flash:",
direction="get",
verify_file=False,
overwrite_file=True,
)
print(output)
Results
{'file_exists': True, 'file_transferred': True, 'file_verified': False}
###Using process_bar functions to display the progress of transferring files in real time
from huawei_file_transfer import file_transfer,progress_bar
from netmiko import ConnectHandler
device_info = {
"device_type": "huawei",
"ip": "192.168.0.253",
"username": "admin123",
"password": "Huawei@123",
}
with ConnectHandler(**device_info) as connect:
print("已经成功登陆设备" + device_info['ip'])
output = file_transfer(
connect,
source_file="s5735-l1-v200r022sph150.pat",
dest_file="s5735-l1-v200r022sph150.pat",
file_system="flash:",
direction="get",
verify_file=False,
overwrite_file=True,
progress=progress_bar
)
print(output)
Results
Transferring file: s5735-l1-v200r022sph150.pat
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>| (100.00%)
{'file_exists': True, 'file_transferred': True, 'file_verified': False}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for huawei_file_transfer-0.0.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9871f70e53c0254c609f7e3ef7d85780896067328fb6edd0c5bcd2bce3769546 |
|
MD5 | 3741920c79ec19425155d04c1fc2e6ac |
|
BLAKE2b-256 | c8ffe4b4547206f3024a49059c90a3b796d747e364c2cb5073f552106deb4525 |
Hashes for huawei_file_transfer-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 54f14fcff47fce055d3b659759d62eeaa68971a3b0aeb98fd5c2aab27a9037d6 |
|
MD5 | e5a71273fa618ce6007d78b4061d055e |
|
BLAKE2b-256 | a476277c7c528343f2c4d65e6d0bc25ffc178a8c4d5580783e5fedb49ac1a534 |