onedrive.save module

This module reads and writes saved upload sessions.

A saved session is ~/.local/share/onedrive/saved_sessions/ID.json, where ID is a unique SHA-1 hexdigest computed from the remote path and the SHA-1 digest of the file. It looks like:

{
    "remote_path": "...",
    "sha1sum": "...",
    "upload_url": "https://api.onedrive.com/up/...",
    "expires": 1433128563
}

where "expires" is a POSIX timestamp.

class onedrive.save.SavedUploadSession(remote_path, sha1sum)[source]

Bases: builtins.object

Saved upload session.

Parameters:

remote_path : str

sha1sum : str

Attributes

remote_path (str)
sha1sum (str)
session_path (str) Path of saved session on disk.
upload_url (str) None when session hasn’t been loaded or saved.
expires (int) POSIX timestamp. None when session hasn’t been loaded or saved.
discard()[source]

Disgard the saved session.

load()[source]

Try to load saved session.

save(upload_url, expiration_datetime)[source]

Write a new session to self and to disk.

expiration_datetime is an ISO-8601 formatted datetime string as returned by the API.

Previous topic

onedrive.log module

Next topic

onedrive.upload_helper module

This Page