Giter VIP home page Giter VIP logo

stkclient's Introduction

Send To Kindle

PyPI Status Python Version License

Read the documentation at https://stkclient.readthedocs.io/ Tests Codecov

stkclient implements a client for amazon's "Send to Kindle" service. It allows python programs to send files to a kindle device without the 10mb limit that applies to email files.

Features

  • OAuth-based authorization
  • Send large (>10MB) files to Kindle devices

Installation

You can install Send To Kindle via pip from PyPI:

$ pip install stkclient

Creating a Client

To create a client, you must authenticate the user. Currently the only supported authentication mechanism is OAuth2:

import stkclient

a = stkclient.OAuth2()
signin_url = a.get_signin_url()
# Open `signin_url` in a browser, sign in and authorize the application, pass
# the final redirect_url below
client = a.create_client(redirect_url)

Once a client is created, it can be serialized and deserialized using Client.load / Client.loads and client.dump / client.dumps

with open('client.json', 'w') as f:
    client.dump(f)
with open('client.json', 'r') as f:
    client = stkclient.Client.load(f)

Sending a File

Once you have a Client object, you can list devices and send files to specified devices.

devices = client.get_owned_devices()
destinations = [d.device_serial_number for d in devices.owned_devices]
client.send_file(filepath, destinations, author=author, title=title)

License

Distributed under the terms of the MIT license, Send To Kindle is free and open source software.

Credits

Project structure from @cjolowicz's Hypermodern Python Cookiecutter template.

stkclient's People

Contributors

dependabot[bot] avatar maxdjohnson avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

alex-kharlamov

stkclient's Issues

send_file requires a format

Hi. For the most part I've got things working. However, the send_file function requires a parameter of 'format' which isn't in the documentation. I'm sending a PDF file, and I've tried using both 'pdf' and 'PDF' but for some reason by the time it arrives on my Kindle the formatting has been completely changed. Obviously something is happening at the Kindle end, but I wondered if there was any other additional settings that I should look at/could adjust that might resolve the issue?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.