Search 1.9 billion lines of Odoo code on GitHub

server_ftp

Author: Therp BV, Odoo Community Association (OCA)
License: AGPL-3
Branch: 16.0-server_ftp
Repository: ntsirintanis/server-tools
Dependencies: base
Languages: HTML (397, 40.1%), Python (309, 31.2%), XML (154, 15.5%), and reStructuredText (131, 13.2%)
Other branches: 13.0-new_module-server_ftp, 13.0-new_module-server_ftp-mock-server, and 13.0-new_module-server_ftp_stable_version
Other repositories: NL66278/server-tools

<h1 class="title">Server FTP</h1> <p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/server-tools/tree/13.0/server_ftp"><img alt="OCA/server-tools" src="https://img.shields.io/badge/github-OCA%2Fserver--tools-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/server-tools-13-0/server-tools-13-0-server_ftp"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runbot.odoo-community.org/runbot/149/13.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p> <p>This module enables connections via FTP, SFTP, FtpLs (wip). Operations such as retrieving a file, checking if a file exists, are all centralized in an Abstract python class, so the user can operate without even noticing what protocol they are using.</p> <p>For more exquisite operations, the user may retrieve a pure connection object in a straighforward way.</p> <p>TODOS: * Secure everything</p> <p><strong>Table of contents</strong></p> <div class="contents local topic" id="contents"> <ul class="simple"> <li><a class="reference internal" href="#installation" id="id1">Installation</a></li> <li><a class="reference internal" href="#configuration" id="id2">Configuration</a></li> <li><a class="reference internal" href="#usage" id="id3">Usage</a></li> <li><a class="reference internal" href="#bug-tracker" id="id4">Bug Tracker</a></li> <li><a class="reference internal" href="#credits" id="id5">Credits</a><ul> <li><a class="reference internal" href="#authors" id="id6">Authors</a></li> <li><a class="reference internal" href="#contributors" id="id7">Contributors</a></li> <li><a class="reference internal" href="#other-credits" id="id8">Other credits</a></li> <li><a class="reference internal" href="#maintainers" id="id9">Maintainers</a></li> </ul> </li> </ul> </div> <a name="installation"></a> <h2><a class="toc-backref" href="#id1">Installation</a></h2> <p>To install this module, you need to:</p> <ol class="arabic simple"> <li>Have pysftp available <code>pip3 install pysftp</code></li> <li>Add it as dependency from your main module.</li> </ol> <a name="configuration"></a> <h2><a class="toc-backref" href="#id2">Configuration</a></h2> <p>To configure this module, you need to:</p> <ol class="arabic simple"> <li>Go <code>to Settings/Technical/FTP/Servers</code></li> <li>Find your favourite protocol and configure connection settings</li> <li>In the form view of the record, edit file structure.</li> <li>If more folders are needed, just add data records with a proper xml_id</li> <li>If more servers are needed, just add data records with a proper xml_id</li> </ol> <a name="usage"></a> <h2><a class="toc-backref" href="#id3">Usage</a></h2> <p>To use this module, you need to:</p> <ol class="arabic simple"> <li>Configure and test you ftp/sftp/lsftp connection</li> <li>Fetch the relevant server.ftp.folder record via it's xmlid</li> <li>Code</li> </ol> <p><code>&gt;&gt;&gt; folder = session.env.ref(&quot;server_ftp.server_ftp_pull_folder_01_ftp&quot;) &gt;&gt;&gt; folder_server_object = folder.connect() # folder_server_object is lib.ftp_server.FtpServer object # You can perform simple operations like ls, put, get, close etc # with folder_server_object. See lib/abstract_ftp_model.py for more &gt;&gt;&gt; folder_server_object.listdir() -rw-rw-r-- 1 1001 1001 0 May 06 14:10 a_file.txt -rw-rw-r-- 1 1001 1001 0 May 06 14:21 another_file.txt &gt;&gt;&gt; server = folder_server_object.get_server() # server is ftplib.FTP object # so we can do anything in ftplib &gt;&gt;&gt; server.dir() -rw-rw-r-- 1 1001 1001 0 May 06 14:10 a_file.txt -rw-rw-r-- 1 1001 1001 0 May 06 14:21 another_file.txt &gt;&gt;&gt; &gt;&gt;&gt; folder_server_object.remove(&quot;a_file.txt&quot;) &gt;&gt;&gt; folder_server_object.listdir() -rw-rw-r-- 1 1001 1001 0 May 06 14:21 another_file.txt &gt;&gt;&gt; server.dir() -rw-rw-r-- 1 1001 1001 0 May 06 14:21 another_file.txt &gt;&gt;&gt; server.delete(&quot;another_file.txt&quot;) '250 Delete operation successful.' &gt;&gt;&gt; folder_server_object.listdir() &gt;&gt;&gt; server.dir() &gt;&gt;&gt; folder_server_object.close() == server.quit()</code></p> <a name="bug-tracker"></a> <h2><a class="toc-backref" href="#id4">Bug Tracker</a></h2> <p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/server-tools/issues">GitHub Issues</a>. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us smashing it by providing a detailed and welcomed <a class="reference external" href="https://github.com/OCA/server-tools/issues/new?body=module:%20server_ftp%0Aversion:%2013.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p> <p>Do not contact contributors directly about support or help with technical issues.</p> <a name="credits"></a> <h2><a class="toc-backref" href="#id5">Credits</a></h2> <a name="authors"></a> <h3><a class="toc-backref" href="#id6">Authors</a></h3> <ul class="simple"> <li>Therp BV</li> </ul> <a name="contributors"></a> <h3><a class="toc-backref" href="#id7">Contributors</a></h3> <ul class="simple"> <li>Nikos Tsirintanis &lt;<a class="reference external" href="mailto:ntsirintanis&#64;therp.nl">ntsirintanis&#64;therp.nl</a>&gt;</li> </ul> <a name="other-credits"></a> <h3><a class="toc-backref" href="#id8">Other credits</a></h3> <p>Therp B.V.</p> <a name="maintainers"></a> <h3><a class="toc-backref" href="#id9">Maintainers</a></h3> <p>This module is maintained by the OCA.</p> <a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a> <p>OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use.</p> <p>This module is part of the <a class="reference external" href="https://github.com/OCA/server-tools/tree/13.0/server_ftp">OCA/server-tools</a> project on GitHub.</p> <p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>