pyplanet.core.storage

exception pyplanet.core.storage.exceptions.StorageException[source]

Base storage exception.

class pyplanet.core.storage.storage.Storage(instance, driver: pyplanet.core.storage.interface.StorageDriver, config)[source]

The storage component manager is managing the storage access trough drivers that can be customized.

Warning

Some drivers are work in progress!

driver

Get the raw driver. Be careful with this!

Returns:Driver Instance
Return type:pyplanet.core.storage.interface.StorageDriver
open(file: str, mode: str = 'rb', **kwargs)[source]

Open a file on the server. Use relative path to the dedicated root. Use the other open methods to relative from another base path.

Parameters:
  • file – Filename/path, relative to the dedicated root path.
  • mode – Mode to open, see the python open manual for supported modes.
Returns:

File handler.

open_map(file: str, mode: str = 'rb', **kwargs)[source]

Open a file on the server. Relative to the Maps folder (UserData/Maps).

Parameters:
  • file – Filename/path, relative to the dedicated maps folder.
  • mode – Mode to open, see the python open manual for supported modes.
Returns:

File handler.

open_match_settings(file: str, mode: str = 'r', **kwargs)[source]

Open a file on the server. Relative to the MatchSettings folder (UserData/Maps/MatchSettings).

Parameters:
  • file – Filename/path, relative to the dedicated matchsettings folder.
  • mode – Mode to open, see the python open manual for supported modes.
Returns:

File handler.

remove_map(file: str)[source]

Remove a map file with filename given.

Parameters:file – Filename, relative to Maps folder.

pyplanet.core.storage.drivers

class pyplanet.core.storage.drivers.local.LocalDriver(instance, config: dict = None)[source]

Local storage driver is using the Python build-in file access utilities for accessing a local storage-like system.

Option BASE_PATH:
 Override the maniaplanet given base path.
class pyplanet.core.storage.drivers.asyncssh.SFTPDriver(instance, config: dict = None)[source]

SFTP storage driver is using the asyncssh module to access storage that is situated remotely.

Warning

This driver is not ready for production use!!

Option HOST:Hostname of destinotion server.
Option PORT:Port destinotion server.
Option USERNAME:
 Username of the user account.
Option PASSWORD:
 Password of the user account. (optional if you use public/private keys).
Option KNOWN_HOSTS:
 File to the Known Hosts file.
Option CLIENT_KEYS:
 Array with client private keys.
Option PASSPHRASE:
 Passphrase to unlock private key(s).
Option KWARGS:Any other options that will be passed to asyncssh.
connect_sftp()[source]

Get sftp client.

Returns:Sftp client.
Return type:asyncssh.SFTPClient