blob: 196ce8551ab7ea51f468f94961d70f7c006b351b [file] [log] [blame]
<!DOCTYPE html>
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>airflow.contrib.hooks.ftp_hook &mdash; Airflow Documentation</title>
<script type="text/javascript" src="../../../../../_static/js/modernizr.min.js"></script>
<script type="text/javascript" id="documentation_options" data-url_root="../../../../../" src="../../../../../_static/documentation_options.js"></script>
<script type="text/javascript" src="../../../../../_static/jquery.js"></script>
<script type="text/javascript" src="../../../../../_static/underscore.js"></script>
<script type="text/javascript" src="../../../../../_static/doctools.js"></script>
<script type="text/javascript" src="../../../../../_static/language_data.js"></script>
<script type="text/javascript" src="../../../../../_static/js/theme.js"></script>
<link rel="stylesheet" href="../../../../../_static/css/theme.css" type="text/css" />
<link rel="stylesheet" href="../../../../../_static/pygments.css" type="text/css" />
<link rel="index" title="Index" href="../../../../../genindex.html" />
<link rel="search" title="Search" href="../../../../../search.html" />
<link rel="next" title="airflow.contrib.hooks.gcp_api_base_hook" href="../gcp_api_base_hook/index.html" />
<link rel="prev" title="airflow.contrib.hooks.fs_hook" href="../fs_hook/index.html" />
<script>
document.addEventListener('DOMContentLoaded', function() {
var el = document.getElementById('changelog');
if (el !== null ) {
// [AIRFLOW-...]
el.innerHTML = el.innerHTML.replace(
/\[(AIRFLOW-[\d]+)\]/g,
`<a href="https://issues.apache.org/jira/browse/$1">[$1]</a>`
);
// (#...)
el.innerHTML = el.innerHTML.replace(
/\(#([\d]+)\)/g,
`<a href="https://github.com/apache/airflow/pull/$1">(#$1)</a>`
);
};
})
</script>
<style>
.example-header {
position: relative;
background: #9AAA7A;
padding: 8px 16px;
margin-bottom: 0;
}
.example-header--with-button {
padding-right: 166px;
}
.example-header:after{
content: '';
display: table;
clear: both;
}
.example-title {
display:block;
padding: 4px;
margin-right: 16px;
color: white;
overflow-x: auto;
}
.example-header-button {
top: 8px;
right: 16px;
position: absolute;
}
.example-header + .highlight-python {
margin-top: 0 !important;
}
.viewcode-button {
display: inline-block;
padding: 8px 16px;
border: 0;
margin: 0;
outline: 0;
border-radius: 2px;
-webkit-box-shadow: 0 3px 5px 0 rgba(0,0,0,.3);
box-shadow: 0 3px 6px 0 rgba(0,0,0,.3);
color: #404040;
background-color: #e7e7e7;
cursor: pointer;
font-size: 16px;
font-weight: 500;
line-height: 1;
text-decoration: none;
text-overflow: ellipsis;
overflow: hidden;
text-transform: uppercase;
-webkit-transition: background-color .2s;
transition: background-color .2s;
vertical-align: middle;
white-space: nowrap;
}
.viewcode-button:visited {
color: #404040;
}
.viewcode-button:hover, .viewcode-button:focus {
color: #404040;
background-color: #d6d6d6;
}
</style>
</head>
<body class="wy-body-for-nav">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-scroll">
<div class="wy-side-nav-search" >
<a href="../../../../../index.html" class="icon icon-home"> Airflow
</a>
<div class="version">
1.10.4
</div>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="../../../../../search.html" method="get">
<input type="text" name="q" placeholder="Search docs" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div>
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="../../../../../project.html">Project</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../../../license.html">License</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../../../start.html">Quick Start</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../../../installation.html">Installation</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../../../tutorial.html">Tutorial</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../../../howto/index.html">How-to Guides</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../../../ui.html">UI / Screenshots</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../../../concepts.html">Concepts</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../../../profiling.html">Data Profiling</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../../../cli.html">Command Line Interface</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../../../scheduler.html">Scheduling &amp; Triggers</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../../../plugins.html">Plugins</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../../../security.html">Security</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../../../timezone.html">Time zones</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../../../api.html">Experimental Rest API</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../../../integration.html">Integration</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../../../metrics.html">Metrics</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../../../kubernetes.html">Kubernetes</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../../../lineage.html">Lineage</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../../../changelog.html">Changelog</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../../../faq.html">FAQ</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../../../macros.html">Macros reference</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="../../../../index.html">API Reference</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="../../../../index.html#operators">Operators</a></li>
<li class="toctree-l2 current"><a class="reference internal" href="../../../../index.html#hooks">Hooks</a><ul class="current">
<li class="toctree-l3 current"><a class="reference internal" href="../../../../index.html#hooks-packages">Hooks packages</a><ul class="current">
<li class="toctree-l4"><a class="reference internal" href="../../../hooks/index.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">airflow.hooks</span></code></a></li>
<li class="toctree-l4 current"><a class="reference internal" href="../index.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">airflow.contrib.hooks</span></code></a></li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="../../../../index.html#executors">Executors</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../../../index.html#models">Models</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../../../index.html#core-and-community-package">Core and community package</a></li>
</ul>
</li>
</ul>
</div>
</div>
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
<nav class="wy-nav-top" aria-label="top navigation">
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="../../../../../index.html">Airflow</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="breadcrumbs navigation">
<ul class="wy-breadcrumbs">
<li><a href="../../../../../index.html">Docs</a> &raquo;</li>
<li><a href="../../../../index.html">API Reference</a> &raquo;</li>
<li><a href="../index.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">airflow.contrib.hooks</span></code></a> &raquo;</li>
<li><code class="xref py py-mod docutils literal notranslate"><span class="pre">airflow.contrib.hooks.ftp_hook</span></code></li>
<li class="wy-breadcrumbs-aside">
<a href="../../../../../_sources/_api/airflow/contrib/hooks/ftp_hook/index.rst.txt" rel="nofollow"> View page source</a>
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<div class="section" id="module-airflow.contrib.hooks.ftp_hook">
<span id="airflow-contrib-hooks-ftp-hook"></span><h1><a class="reference internal" href="#module-airflow.contrib.hooks.ftp_hook" title="airflow.contrib.hooks.ftp_hook"><code class="xref py py-mod docutils literal notranslate"><span class="pre">airflow.contrib.hooks.ftp_hook</span></code></a><a class="headerlink" href="#module-airflow.contrib.hooks.ftp_hook" title="Permalink to this headline"></a></h1>
<div class="section" id="module-contents">
<h2>Module Contents<a class="headerlink" href="#module-contents" title="Permalink to this headline"></a></h2>
<dl class="function">
<dt id="airflow.contrib.hooks.ftp_hook.mlsd">
<code class="sig-prename descclassname">airflow.contrib.hooks.ftp_hook.</code><code class="sig-name descname">mlsd</code><span class="sig-paren">(</span><em class="sig-param">conn</em>, <em class="sig-param">path=''</em>, <em class="sig-param">facts=None</em><span class="sig-paren">)</span><a class="reference internal" href="../../../../../_modules/airflow/contrib/hooks/ftp_hook.html#mlsd"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#airflow.contrib.hooks.ftp_hook.mlsd" title="Permalink to this definition"></a></dt>
<dt>
<code class="sig-name descname">BACKPORT FROM PYTHON3 FTPLIB.</code></dt>
<dd><p>List a directory in a standardized format by using MLSD
command (RFC-3659). If path is omitted the current directory
is assumed. “facts” is a list of strings representing the type
of information desired (e.g. [“type”, “size”, “perm”]).</p>
<p>Return a generator object yielding a tuple of two elements
for every file found in path.
First element is the file name, the second one is a dictionary
including a variable number of “facts” depending on the server
and whether “facts” argument has been provided.</p>
</dd></dl>
<dl class="class">
<dt id="airflow.contrib.hooks.ftp_hook.FTPHook">
<em class="property">class </em><code class="sig-prename descclassname">airflow.contrib.hooks.ftp_hook.</code><code class="sig-name descname">FTPHook</code><span class="sig-paren">(</span><em class="sig-param">ftp_conn_id='ftp_default'</em><span class="sig-paren">)</span><a class="reference internal" href="../../../../../_modules/airflow/contrib/hooks/ftp_hook.html#FTPHook"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#airflow.contrib.hooks.ftp_hook.FTPHook" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="../../../hooks/base_hook/index.html#airflow.hooks.base_hook.BaseHook" title="airflow.hooks.base_hook.BaseHook"><code class="xref py py-class docutils literal notranslate"><span class="pre">airflow.hooks.base_hook.BaseHook</span></code></a></p>
<p>Interact with FTP.</p>
<p>Errors that may occur throughout but should be handled downstream.
You can specify mode for data transfers in the extra field of your
connection as <code class="docutils literal notranslate"><span class="pre">{&quot;passive&quot;:</span> <span class="pre">&quot;true&quot;}</span></code>.</p>
<dl class="method">
<dt id="airflow.contrib.hooks.ftp_hook.FTPHook.__enter__">
<code class="sig-name descname">__enter__</code><span class="sig-paren">(</span><em class="sig-param">self</em><span class="sig-paren">)</span><a class="reference internal" href="../../../../../_modules/airflow/contrib/hooks/ftp_hook.html#FTPHook.__enter__"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#airflow.contrib.hooks.ftp_hook.FTPHook.__enter__" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="airflow.contrib.hooks.ftp_hook.FTPHook.__exit__">
<code class="sig-name descname">__exit__</code><span class="sig-paren">(</span><em class="sig-param">self</em>, <em class="sig-param">exc_type</em>, <em class="sig-param">exc_val</em>, <em class="sig-param">exc_tb</em><span class="sig-paren">)</span><a class="reference internal" href="../../../../../_modules/airflow/contrib/hooks/ftp_hook.html#FTPHook.__exit__"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#airflow.contrib.hooks.ftp_hook.FTPHook.__exit__" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="airflow.contrib.hooks.ftp_hook.FTPHook.get_conn">
<code class="sig-name descname">get_conn</code><span class="sig-paren">(</span><em class="sig-param">self</em><span class="sig-paren">)</span><a class="reference internal" href="../../../../../_modules/airflow/contrib/hooks/ftp_hook.html#FTPHook.get_conn"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#airflow.contrib.hooks.ftp_hook.FTPHook.get_conn" title="Permalink to this definition"></a></dt>
<dd><p>Returns a FTP connection object</p>
</dd></dl>
<dl class="method">
<dt id="airflow.contrib.hooks.ftp_hook.FTPHook.close_conn">
<code class="sig-name descname">close_conn</code><span class="sig-paren">(</span><em class="sig-param">self</em><span class="sig-paren">)</span><a class="reference internal" href="../../../../../_modules/airflow/contrib/hooks/ftp_hook.html#FTPHook.close_conn"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#airflow.contrib.hooks.ftp_hook.FTPHook.close_conn" title="Permalink to this definition"></a></dt>
<dd><p>Closes the connection. An error will occur if the
connection wasn’t ever opened.</p>
</dd></dl>
<dl class="method">
<dt id="airflow.contrib.hooks.ftp_hook.FTPHook.describe_directory">
<code class="sig-name descname">describe_directory</code><span class="sig-paren">(</span><em class="sig-param">self</em>, <em class="sig-param">path</em><span class="sig-paren">)</span><a class="reference internal" href="../../../../../_modules/airflow/contrib/hooks/ftp_hook.html#FTPHook.describe_directory"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#airflow.contrib.hooks.ftp_hook.FTPHook.describe_directory" title="Permalink to this definition"></a></dt>
<dd><p>Returns a dictionary of {filename: {attributes}} for all files
on the remote system (where the MLSD command is supported).</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>path</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) – full path to the remote directory</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="airflow.contrib.hooks.ftp_hook.FTPHook.list_directory">
<code class="sig-name descname">list_directory</code><span class="sig-paren">(</span><em class="sig-param">self</em>, <em class="sig-param">path</em>, <em class="sig-param">nlst=False</em><span class="sig-paren">)</span><a class="reference internal" href="../../../../../_modules/airflow/contrib/hooks/ftp_hook.html#FTPHook.list_directory"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#airflow.contrib.hooks.ftp_hook.FTPHook.list_directory" title="Permalink to this definition"></a></dt>
<dd><p>Returns a list of files on the remote system.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>path</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) – full path to the remote directory to list</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="airflow.contrib.hooks.ftp_hook.FTPHook.create_directory">
<code class="sig-name descname">create_directory</code><span class="sig-paren">(</span><em class="sig-param">self</em>, <em class="sig-param">path</em><span class="sig-paren">)</span><a class="reference internal" href="../../../../../_modules/airflow/contrib/hooks/ftp_hook.html#FTPHook.create_directory"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#airflow.contrib.hooks.ftp_hook.FTPHook.create_directory" title="Permalink to this definition"></a></dt>
<dd><p>Creates a directory on the remote system.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>path</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) – full path to the remote directory to create</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="airflow.contrib.hooks.ftp_hook.FTPHook.delete_directory">
<code class="sig-name descname">delete_directory</code><span class="sig-paren">(</span><em class="sig-param">self</em>, <em class="sig-param">path</em><span class="sig-paren">)</span><a class="reference internal" href="../../../../../_modules/airflow/contrib/hooks/ftp_hook.html#FTPHook.delete_directory"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#airflow.contrib.hooks.ftp_hook.FTPHook.delete_directory" title="Permalink to this definition"></a></dt>
<dd><p>Deletes a directory on the remote system.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>path</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) – full path to the remote directory to delete</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="airflow.contrib.hooks.ftp_hook.FTPHook.retrieve_file">
<code class="sig-name descname">retrieve_file</code><span class="sig-paren">(</span><em class="sig-param">self</em>, <em class="sig-param">remote_full_path</em>, <em class="sig-param">local_full_path_or_buffer</em>, <em class="sig-param">callback=None</em><span class="sig-paren">)</span><a class="reference internal" href="../../../../../_modules/airflow/contrib/hooks/ftp_hook.html#FTPHook.retrieve_file"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#airflow.contrib.hooks.ftp_hook.FTPHook.retrieve_file" title="Permalink to this definition"></a></dt>
<dd><p>Transfers the remote file to a local location.</p>
<p>If local_full_path_or_buffer is a string path, the file will be put
at that location; if it is a file-like buffer, the file will
be written to the buffer but not closed.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>remote_full_path</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) – full path to the remote file</p></li>
<li><p><strong>local_full_path_or_buffer</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a><em> or </em><em>file-like buffer</em>) – full path to the local file or a
file-like buffer</p></li>
<li><p><strong>callback</strong> (<em>callable</em>) – callback which is called each time a block of data
is read. if you do not use a callback, these blocks will be written
to the file or buffer passed in. if you do pass in a callback, note
that writing to a file or buffer will need to be handled inside the
callback.
[default: output_handle.write()]</p></li>
</ul>
</dd>
</dl>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="n">hook</span> <span class="o">=</span> <span class="n">FTPHook</span><span class="p">(</span><span class="n">ftp_conn_id</span><span class="o">=</span><span class="s1">&#39;my_conn&#39;</span><span class="p">)</span>
<span class="n">remote_path</span> <span class="o">=</span> <span class="s1">&#39;/path/to/remote/file&#39;</span>
<span class="n">local_path</span> <span class="o">=</span> <span class="s1">&#39;/path/to/local/file&#39;</span>
<span class="c1"># with a custom callback (in this case displaying progress on each read)</span>
<span class="k">def</span> <span class="nf">print_progress</span><span class="p">(</span><span class="n">percent_progress</span><span class="p">):</span>
<span class="bp">self</span><span class="o">.</span><span class="n">log</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="s1">&#39;Percent Downloaded: </span><span class="si">%s%%</span><span class="s1">&#39;</span> <span class="o">%</span> <span class="n">percent_progress</span><span class="p">)</span>
<span class="n">total_downloaded</span> <span class="o">=</span> <span class="mi">0</span>
<span class="n">total_file_size</span> <span class="o">=</span> <span class="n">hook</span><span class="o">.</span><span class="n">get_size</span><span class="p">(</span><span class="n">remote_path</span><span class="p">)</span>
<span class="n">output_handle</span> <span class="o">=</span> <span class="nb">open</span><span class="p">(</span><span class="n">local_path</span><span class="p">,</span> <span class="s1">&#39;wb&#39;</span><span class="p">)</span>
<span class="k">def</span> <span class="nf">write_to_file_with_progress</span><span class="p">(</span><span class="n">data</span><span class="p">):</span>
<span class="n">total_downloaded</span> <span class="o">+=</span> <span class="nb">len</span><span class="p">(</span><span class="n">data</span><span class="p">)</span>
<span class="n">output_handle</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="n">data</span><span class="p">)</span>
<span class="n">percent_progress</span> <span class="o">=</span> <span class="p">(</span><span class="n">total_downloaded</span> <span class="o">/</span> <span class="n">total_file_size</span><span class="p">)</span> <span class="o">*</span> <span class="mi">100</span>
<span class="n">print_progress</span><span class="p">(</span><span class="n">percent_progress</span><span class="p">)</span>
<span class="n">hook</span><span class="o">.</span><span class="n">retrieve_file</span><span class="p">(</span><span class="n">remote_path</span><span class="p">,</span> <span class="bp">None</span><span class="p">,</span> <span class="n">callback</span><span class="o">=</span><span class="n">write_to_file_with_progress</span><span class="p">)</span>
<span class="c1"># without a custom callback data is written to the local_path</span>
<span class="n">hook</span><span class="o">.</span><span class="n">retrieve_file</span><span class="p">(</span><span class="n">remote_path</span><span class="p">,</span> <span class="n">local_path</span><span class="p">)</span>
</pre></div>
</div>
</dd></dl>
<dl class="method">
<dt id="airflow.contrib.hooks.ftp_hook.FTPHook.store_file">
<code class="sig-name descname">store_file</code><span class="sig-paren">(</span><em class="sig-param">self</em>, <em class="sig-param">remote_full_path</em>, <em class="sig-param">local_full_path_or_buffer</em><span class="sig-paren">)</span><a class="reference internal" href="../../../../../_modules/airflow/contrib/hooks/ftp_hook.html#FTPHook.store_file"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#airflow.contrib.hooks.ftp_hook.FTPHook.store_file" title="Permalink to this definition"></a></dt>
<dd><p>Transfers a local file to the remote location.</p>
<p>If local_full_path_or_buffer is a string path, the file will be read
from that location; if it is a file-like buffer, the file will
be read from the buffer but not closed.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>remote_full_path</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) – full path to the remote file</p></li>
<li><p><strong>local_full_path_or_buffer</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a><em> or </em><em>file-like buffer</em>) – full path to the local file or a
file-like buffer</p></li>
</ul>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="airflow.contrib.hooks.ftp_hook.FTPHook.delete_file">
<code class="sig-name descname">delete_file</code><span class="sig-paren">(</span><em class="sig-param">self</em>, <em class="sig-param">path</em><span class="sig-paren">)</span><a class="reference internal" href="../../../../../_modules/airflow/contrib/hooks/ftp_hook.html#FTPHook.delete_file"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#airflow.contrib.hooks.ftp_hook.FTPHook.delete_file" title="Permalink to this definition"></a></dt>
<dd><p>Removes a file on the FTP Server.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>path</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) – full path to the remote file</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="airflow.contrib.hooks.ftp_hook.FTPHook.rename">
<code class="sig-name descname">rename</code><span class="sig-paren">(</span><em class="sig-param">self</em>, <em class="sig-param">from_name</em>, <em class="sig-param">to_name</em><span class="sig-paren">)</span><a class="reference internal" href="../../../../../_modules/airflow/contrib/hooks/ftp_hook.html#FTPHook.rename"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#airflow.contrib.hooks.ftp_hook.FTPHook.rename" title="Permalink to this definition"></a></dt>
<dd><p>Rename a file.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>from_name</strong> – rename file from name</p></li>
<li><p><strong>to_name</strong> – rename file to name</p></li>
</ul>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="airflow.contrib.hooks.ftp_hook.FTPHook.get_mod_time">
<code class="sig-name descname">get_mod_time</code><span class="sig-paren">(</span><em class="sig-param">self</em>, <em class="sig-param">path</em><span class="sig-paren">)</span><a class="reference internal" href="../../../../../_modules/airflow/contrib/hooks/ftp_hook.html#FTPHook.get_mod_time"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#airflow.contrib.hooks.ftp_hook.FTPHook.get_mod_time" title="Permalink to this definition"></a></dt>
<dd><p>Returns a datetime object representing the last time the file was modified</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>path</strong> (<em>string</em>) – remote file path</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="airflow.contrib.hooks.ftp_hook.FTPHook.get_size">
<code class="sig-name descname">get_size</code><span class="sig-paren">(</span><em class="sig-param">self</em>, <em class="sig-param">path</em><span class="sig-paren">)</span><a class="reference internal" href="../../../../../_modules/airflow/contrib/hooks/ftp_hook.html#FTPHook.get_size"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#airflow.contrib.hooks.ftp_hook.FTPHook.get_size" title="Permalink to this definition"></a></dt>
<dd><p>Returns the size of a file (in bytes)</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>path</strong> (<em>string</em>) – remote file path</p>
</dd>
</dl>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="airflow.contrib.hooks.ftp_hook.FTPSHook">
<em class="property">class </em><code class="sig-prename descclassname">airflow.contrib.hooks.ftp_hook.</code><code class="sig-name descname">FTPSHook</code><a class="reference internal" href="../../../../../_modules/airflow/contrib/hooks/ftp_hook.html#FTPSHook"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#airflow.contrib.hooks.ftp_hook.FTPSHook" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="#airflow.contrib.hooks.ftp_hook.FTPHook" title="airflow.contrib.hooks.ftp_hook.FTPHook"><code class="xref py py-class docutils literal notranslate"><span class="pre">airflow.contrib.hooks.ftp_hook.FTPHook</span></code></a></p>
<dl class="method">
<dt id="airflow.contrib.hooks.ftp_hook.FTPSHook.get_conn">
<code class="sig-name descname">get_conn</code><span class="sig-paren">(</span><em class="sig-param">self</em><span class="sig-paren">)</span><a class="reference internal" href="../../../../../_modules/airflow/contrib/hooks/ftp_hook.html#FTPSHook.get_conn"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#airflow.contrib.hooks.ftp_hook.FTPSHook.get_conn" title="Permalink to this definition"></a></dt>
<dd><p>Returns a FTPS connection object.</p>
</dd></dl>
</dd></dl>
</div>
</div>
</div>
</div>
<footer>
<div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
<a href="../gcp_api_base_hook/index.html" class="btn btn-neutral float-right" title="airflow.contrib.hooks.gcp_api_base_hook" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right"></span></a>
<a href="../fs_hook/index.html" class="btn btn-neutral float-left" title="airflow.contrib.hooks.fs_hook" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> Previous</a>
</div>
<hr/>
<div role="contentinfo">
<p>
</p>
</div>
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/rtfd/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
</section>
</div>
<script type="text/javascript">
jQuery(function () {
SphinxRtdTheme.Navigation.enable(true);
});
</script>
</body>
</html>