protocol.ftp.client Module

FTP client.

class wpull.protocol.ftp.client.Client(*args, **kwargs)[source]

Bases: wpull.protocol.abstract.client.BaseClient

FTP Client.

The session object is Session.

session() → wpull.protocol.ftp.client.Session[source]
class wpull.protocol.ftp.client.Session(login_table: weakref.WeakKeyDictionary, **kwargs)[source]

Bases: wpull.protocol.abstract.client.BaseSession

class Event[source]

Bases: enum.Enum

Session.abort()[source]
Session.download(file: typing.Union=None, rewind: bool=True, duration_timeout: typing.Union=None) → wpull.protocol.ftp.request.Response[source]

Read the response content into file.

Parameters:
  • file – A file object or asyncio stream.
  • rewind – Seek the given file back to its original offset after reading is finished.
  • duration_timeout – Maximum time in seconds of which the entire file must be read.
Returns:

A Response populated with the final data connection reply.

Be sure to call start() first.

Coroutine.

Session.download_listing(file: typing.Union, duration_timeout: typing.Union=None) → wpull.protocol.ftp.request.ListingResponse[source]

Read file listings.

Parameters:
  • file – A file object or asyncio stream.
  • duration_timeout – Maximum time in seconds of which the entire file must be read.
Returns:

A Response populated the file listings

Be sure to call start_file_listing() first.

Coroutine.

Session.recycle()[source]
Session.start(request: wpull.protocol.ftp.request.Request) → wpull.protocol.ftp.request.Response[source]

Start a file or directory listing download.

Parameters:request – Request.
Returns:A Response populated with the initial data connection reply.

Once the response is received, call download().

Coroutine.

Session.start_listing(request: wpull.protocol.ftp.request.Request) → wpull.protocol.ftp.request.ListingResponse[source]

Fetch a file listing.

Parameters:request – Request.
Returns:A listing response populated with the initial data connection reply.

Once the response is received, call download_listing().

Coroutine.

class wpull.protocol.ftp.client.SessionState[source]

Bases: enum.Enum