perda.server.client#

class perda.server.client.ServerClient(url, cache_dir=None)[source]#

Bases: object

Client for accessing log data from the PER data server.

Authenticates with the gateway, browses available logs with metadata, and downloads CSV files directly from S3 for analysis.

Parameters:
  • url (str) – Base URL of the data server (e.g. "https://data.example.com")

  • cache_dir (str | None) – Local directory for caching downloaded logs. When set, repeated load() calls for the same log skip the download. None disables caching and uses a temporary file each time.

Examples

>>> client = ServerClient("https://data.example.com")
>>> client.login("password")
>>> logs = client.list_logs("REV 11/")
>>> aly = client.load("REV 11/2026-04-01/test.csv")
>>> aly.plot("ams.pack.voltage")
list_logs(prefix='')[source]#

List available logs under an S3 prefix, with metadata.

Parameters:

prefix (str) – S3 key prefix to browse (e.g. "REV 11/"). Use "" for the bucket root.

Returns:

Combined S3 listing and metadata for each entry.

Return type:

List[LogEntry]

Examples

>>> logs = client.list_logs("REV 11/")
>>> for log in logs:
...     print(log)
load(log_key, ts_offset=0, parsing_errors_limit=100)[source]#

Download a log from S3 and return an Analyzer instance.

Parameters:
  • log_key (str) – Full S3 key of the log file

  • ts_offset (int) – Timestamp offset passed to Analyzer. Default is 0.

  • parsing_errors_limit (int) – Maximum parsing errors passed to Analyzer. Default is 100.

Returns:

Ready-to-use Analyzer loaded with the downloaded data.

Return type:

Analyzer

Examples

>>> aly = client.load("REV 11/2026-04-01/test.csv")
>>> print(aly)
login(password)[source]#

Authenticate with the data server.

Parameters:

password (str) – Server password

Raises:

ConnectionError – If login fails or the server is unreachable.

Return type:

None

print_logs(prefix='')[source]#

Print a formatted listing of available logs.

Parameters:

prefix (str) – S3 key prefix to browse. Default is "" (bucket root).

Return type:

None

Examples

>>> client.print_logs("REV 11/")