当前位置:网站首页>Pysmb usage
Pysmb usage
2022-06-13 00:57:00 【Python's path to becoming a God】
install pysmb
pip install pysmb
I installed 1.2.7
Use pysmb
from smb.SMBConnection import SMBConnection
# And samba Server establishes connection
# -*- coding: utf-8 -*-
# @Time : 2022/2/26 9:46
# @Author : heyubin
# @Email : [email protected]
# @File : pysmb_test.py
from smb.SMBConnection import *
# param1:username
# param2:password
# param3:local NetBIOS machine name
# param4:remote NetBIOS machine name
samba = SMBConnection("17358882238", "19990123hyb", '', '') # By default ,samba Agreed NetBIOS Is turned off , So fill in the blank
# param1: samba Server's IP Address
assert samba.connect("192.168.1.121") # Connect samba The server
# Upload files
f = open("python.txt", 'rb') # It is recommended to use b Model open file , Tests have found that there are always some strange problems
# param1: samba Shared path of the server
# param2: Under the common path , File path ( Here, you need to specify upload to samba Which file on the server , If not, it will create a ),
# param3: You need to upload the object of the file ( The class to which this object belongs must have read() Method )
samba.storeFile('17358882238_Home1', 'Public/python.txt', f)
f.close()
# Download the file
f = open("test.txt", 'wb')
# param1: samba Shared path of the server
# param2: Under the shared path , File path
# param3: You need to download the object of the file
samba.retrieveFile('17358882238_Home1', "Public/DPU.txt", f)
f.close()
# samba Objects and many others API function
# samba.createDirectory()
# samba.deleteDirectory()
# samba.deleteFiles()
# samba.listShares()
# samba.listPath()
samba.close()
边栏推荐
- Key point detection data preparation and model design based on u-net Network -- detection model of four key points of industrial components
- [JS component] create a custom horizontal and vertical scroll bar following the steam style
- Physical orbit simulation
- With a market value of more than trillion yuan and a sales volume of more than 100000 yuan for three consecutive months, will BYD become the strongest domestic brand?
- Maybe we can figure out the essence of the Internet after the dust falls
- sort
- Unitywebrequest asynchronous Download
- Rotating camera
- 市值破万亿,连续三个月销量破10万,比亚迪会成为最强国产品牌?
- Kotlin 协程的作用域构建器 coroutineScope与runBlocking 与supervisorScope,协程同步运行,协程挂掉的时候其他协程如何不被挂掉。
猜你喜欢

Arduino controls tb6600 driver +42 stepper motor

Liu Hui and introduction to nine chapter arithmetic and island arithmetic

Kotlin coroutine suspend function suspend keyword

【SCA-CNN 解读】空间与通道注意力:Spatial and Channel-wise Attention

Canvas game lower level 100

(01).NET MAUI实战 建项目

Common skills of quantitative investment - index part 2: detailed explanation of BOL (Bollinger line) index, its code implementation and drawing

How to handle different types of data

Pipeline pipeline project construction

How to choose stocks? Which indicator strategy is reliable? Quantitative analysis and comparison of DBCD, ROC, vroc, Cr and psy index strategy income
随机推荐
Unitywebrequest asynchronous Download
Antdpro - protable realizes the linkage effect of two selection boxes
Kotlin 协程的四种启动模式
Kotlin 协程挂起函数 suspend 关键字
Pipeline pipeline project construction
Go simple read database
3623. Merge two ordered arrays
[network protocol] problems and solutions in the use of LwIP
[JS component] create a custom horizontal and vertical scroll bar following the steam style
How to determine whether T is a value type in a generic type or a reference class- How to determine whether T is a value type or reference class in generic?
Hard (magnetic) disk (I)
Today's sleep quality record 74 points
People and gods are angry. Details of Tangshan "mass beating of women incident"
What is meebits? A brief explanation
Andersen global expands its business in northern Europe through cooperation agreements in Finland and Denmark
. The way to prove the effect of throwing exceptions on performance in. Net core
How many rounds of deep learning training? How many iterations?
Dynamic planning - good article link
Can GPU acceleration pytorch work?
Download nail live playback through packet capturing