setting up azure sftp and python script to upload files

Publicado em: 12 Agosto 2022
no canal de: Adimulam Natarajan
965
3

This is a 3 part series explaining everything in simple and easy 25 steps.
I'm a best practioner to keep the enviornment safe and clean,
that added certain additional steps at the end that gave birth to part 3,
and hope you can bear with me considering the costs and benefits.

Part 1 - setting up azure sftp

1. login to portal.azure.com
2. create testRG
3. create storage a/c - sftsademo
4. LRS
5. Enable hierarchical namespace, checkbox
6. Enable SFT preview
7. wait and when finished click on goto resources button
8. click on containers
9. click on +Container
10. name: testcontainer
11. add folder public
12. SFT preview
13. Add user
14. copy SSH password
15. note down username, connection string

...

16. test connection with winscp

Part 2: file upload with python script

1. make sure you have VS Code and latest python installed
2. create a folder sftp demo
3, cd sftdemo
4. pip install pysftp
5. code .
6. create a new file main.py
7. copy the code below

import pysftp

FTP_HOST = "..."
FTP_USER = "..."
FTP_PASS = "..."

class UploadToFtp:
def __init__(self, folder, export_file):
try:
cnopts = pysftp.CnOpts()
cnopts.hostkeys = None
with pysftp.Connection(
host = FTP_HOST,
username = FTP_USER,
password = FTP_PASS,
cnopts = cnopts) as sftp:
print("Connection succesfully stablished ... ")
sftp.cwd(folder)
sftp.put(export_file)
sftp.close()
except Exception as ex:
print(ex)

8. make necessay changes to the code
9. Test your code

Part 3: cleanup azure and keep enviornment safe

Always dispose things that you don't need to keep the world slim, clean and safe

1. click on Home
2. click on testRG
3. CLICK ON 'Delete resource group'

Hope you enjoyed my video!
please do subscribe so that you get notified when I release a new video

Thanks, Adi


Nesta página do site você pode assistir ao vídeo on-line setting up azure sftp and python script to upload files duração hora minuto segundo em boa qualidade , que foi baixado pelo usuário Adimulam Natarajan 12 Agosto 2022, compartilhe o link com seus amigos e conhecidos, no youtube este vídeo já foi visto 965 vezes e gostou 3 espectadores. Boa visualização!