Try to make client FTP fastest with Pythonista

Pythonista [Python for iOS]

Pythonista is an app that makes your iOS device powerful. Not to mention serverization, various other things are possible.

Furthermore, it can be executed not only in Python 2.7 but also in Python 3.5. Not only can you write Python code, but you can't beat the original keyboard, terminal (console), editor, extensions, etc ...

Move on to the code description.

FTP client code

FTP.py


# coding=utf-8
#############################
# FileName: FTP.py
#.
#├── FTP.py
#└── var
#    └── tmp
#        └── test.html
#############################
## improt
from ftplib import FTP_TLS

##variable variable
ftp_serveraddress = 'ftp address'
ftp_user = 'account name'
ftp_password = 'password'
ftp_putdir = './var/tmp/'
ftp_putfile = 'test.html'

def ftpput(host, username, password, putdir, putfile):
    try:
        ftp_putdir = "/"
        _putfile = '%s%s' % (putdir, putfile)
        print _putfile
        print "FTP Start."
        #For FTP
        # _ftp = FTP(host) #FTP communication
        _ftps = FTP_TLS(host) #FTPS communication
        #Debug log output(0:None/1:command/2:Details)
        _ftps.set_debuglevel(1) #You can check the debug log in real time.
        _ftps.login(username, password)
        print _ftps.getwelcome()
        print "Login OK! : %s" % (_ftps)
        _ftps.cwd(ftp_putdir)
        print "File Open."
        _file = open(_putfile, 'rb')
        command = 'STOR %s' % putfile #Because command operation is required
        _ftps.storlines(command, _file)
        _file.close()
        print _ftps.quit()
        print "File UP Complete!"
    except:
        _ftps.quit()
        print "ERR!! ftpput_failed :" + _putfile

if __name__ == '__main__':
    ftpput(ftp_serveraddress, ftp_user, ftp_password, ftp_putdir, ftp_putfile)

You now have a simple FTP client. The place where the file is specified is not cool, but ...

The challenge this time is that it is possible to communicate with FTPS instead of FTP communication. I would like to make the next application considering the UI etc. so that the user side will be comfortable.

※Caution※

If you upload a file with the same name, it will be overwritten.

Recommended Posts

Try to make client FTP fastest with Pythonista
Try to make your own AWS-SDK with bash
Try to make a command standby tool with python
Try to make RESTful API with MVC using Flask 1.0.2
Easy to make with syntax
Try to operate Facebook with Python
Try to profile with ONNX Runtime
How to use FTP with Python
Try to output audio with M5STACK
The fastest way to try EfficientNet
Try to make a web service-like guy with 3D markup language
Try to make capture software with as high accuracy as possible with python (1)
[TCP / IP] After studying, try to make an HTTP client-like with Python
Try to reproduce color film with Python
Try logging in to qiita with Python
Try to make a kernel of Jupyter
Try to make a capture software with as high accuracy as possible with python (2)
Fractal to make and play with Python
Try to make foldl and foldr with Python: lambda. Also time measurement
Add images to iOS photos with Pythonista
Try converting to tidy data with pandas
Quickly try to visualize datasets with pandas
First YDK to try with Cisco IOS-XE
Try to generate an image with aliasing
Try to make something like C # LINQ
Try to make BOT by linking spreadsheet and Slack with python 2/2 (python + gspread + slackbot)
Try to make BOT by linking spreadsheet and Slack with python 1/2 (python + gspread + slackbot)
WEB scraping with python and try to make a word cloud from reviews
A memorandum to make WebDAV only with nginx
Crop the image to rounded corners with pythonista
Try to aggregate doujin music data with pandas
Try to solve the man-machine chart with Python
Try to extract Azure document DB document with pydocumentdb
AI beginners try to make professional student bots
Try to draw a life curve with python
How to make a dictionary with a hierarchical structure.
I want to make a game with Python
Try to make matplotlib's color cycle look good
Try to communicate with EV3 and PC! (MQTT)
How to try the friends-of-friends algorithm with pyfof
Try to automatically generate Python documents with Sphinx
Route guidance to iPhone photography location with Pythonista
How to make Linux compatible with Japanese keyboard
Try to detect fish with python + OpenCV2.4 (unfinished)
Beginners try to make an online battle Othello web application with Django + React + Bootstrap (1)
Try to solve the programming challenge book with python3
[First API] Try to get Qiita articles with Python
Try to make a Python module in C language
Explain in detail how to make sounds with python
Try to dynamically create a Checkbutton with Python's Tkinter
Try to solve the internship assignment problem with Python
Try to operate DB with Python and visualize with d3
Try to predict forex (FX) with non-deep machine learning
Schema-driven development with Responder: Try to display Swagger UI
[GCP] Try a sample to authenticate users with Firebase
Make a function to describe Japanese fonts with OpenCV
[Neo4J] ④ Try to handle the graph structure with Cypher
How to make an HTTPS server with Go / Gin
A sample to try Factorization Machines quickly with fastFM
Machine learning beginners try to make a decision tree
Try to tamper with requests from iphone with Burp Suite