Reference#

stkclient#

Send To Kindle.

class stkclient.Client(_device_info)#

Supports listing devices and sending files to specific devices.

Parameters:

_device_info (DeviceInfo) –

dump(fp)#

Serializes the client into a file-like object.

Parameters:

fp (TextIO) –

Return type:

None

dumps()#

Serializes the client into a string.

Return type:

str

get_owned_devices()#

Returns a list of kindle devices owned by the end-user.

Returns:

List of OwnedDevice instances.

Return type:

List[OwnedDevice]

static load(fp)#

Deserializes a client from a file-like object.

Parameters:

fp (Union[TextIO, BinaryIO]) –

Return type:

Client

static loads(s)#

Deserializes a client from a string.

Parameters:

s (str) –

Return type:

Client

logout()#

Logs out the client.

Return type:

None

send_file(file_path, target_device_serial_numbers, *, author, title, format)#

Sends a file to the specified kindle devices.

Parameters:
  • file_path (Path) – The file to send

  • target_device_serial_numbers (List[str]) – The devices to receive the file.

  • author (str) – The author of the document.

  • title (str) – The title of the document.

  • format (str) – The format of the document.

Returns:

sku identifier assigned by amazon.

Return type:

str

class stkclient.OAuth2#

Authenticates an end-user using amazon’s OAuth2.

create_client(redirect_url)#

Creates a client with the authorization code from the redirect URL.

Parameters:

redirect_url (str) – The final oauth redirect URL.

Returns:

Client instance.

Return type:

Client

get_signin_url()#

Gets the signin URL. Open in a web browser to start authentication.

Return type:

str

class stkclient.OwnedDevice(device_capabilities, device_name, device_serial_number)#

Represents a user device supported by send-to-kindle.

Parameters:
  • device_capabilities (Mapping[str, bool]) –

  • device_name (str) –

  • device_serial_number (str) –

device_capabilities#

Mapping of capability name to boolean

Type:

Mapping[str, bool]

device_name#

Human readable device name specified by the end user.

Type:

str

device_serial_number#

Unique ID of this device.

Type:

str

static from_dict(d)#

Constructs an OwnedDevice from a dictionary of attributes, ignoring unknown fields.

Parameters:

d (Mapping[str, Any]) –

Return type:

OwnedDevice