aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Crute <mike@crute.us>2017-10-07 18:04:41 +0000
committerMike Crute <mike@crute.us>2017-10-07 18:04:41 +0000
commit2073caf08a4f65b7e45b05b8e9149b54d841e63f (patch)
tree47084bfbaab1fa7eda864fb629891e224f720666
parent954816d5c27fd03e2896e7d79b7cb1175bb037ce (diff)
downloadpydora-2073caf08a4f65b7e45b05b8e9149b54d841e63f.tar.bz2
pydora-2073caf08a4f65b7e45b05b8e9149b54d841e63f.tar.xz
pydora-2073caf08a4f65b7e45b05b8e9149b54d841e63f.zip
Add programatic use instructions to readme
-rw-r--r--README.rst52
1 files changed, 48 insertions, 4 deletions
diff --git a/README.rst b/README.rst
index f317900..7de2827 100644
--- a/README.rst
+++ b/README.rst
@@ -20,10 +20,54 @@ Keys or passwords for Pandora are **not** provided in this repo, you'll have to
20for yourself. Make something awesome with this library, don't abuse Pandora, 20for yourself. Make something awesome with this library, don't abuse Pandora,
21that's not cool. 21that's not cool.
22 22
23The easy entry-point for programmatic use is 23As of 1.11.0 users of Python 3.4+ no longer require a native dependency and can
24``pandora.clientbuilder.PydoraConfigFileBuilder``. All programmatic APIs are in 24use this package in its pure Python form. Users of older versions of Python
25the ``pandora`` package. The remainder of this README is targeted at users of 25will require `cryptography <https://pypi.python.org/pypi/cryptography>`_. This
26the ``pydora`` command-line player. 26is configured automatically when pydora is installed.
27
28Programatic Use
29===============
30The pydora distribution contains two python packages. The ``pandora`` package
31is the API for interacting with the Pandora service. The ``pydora`` package is
32a very small reference implementation of using the API to drive a command line
33player. If you're interested in the command line skip this section and read
34Installing below to get started.
35
36**NOTE:** This package uses semantic versioning. The API is stable within a
37major version release. Please constrain your dependencies to major versions.
38For example, to depend on version 1.x use this line in your setup.py
39``install_requires``::
40
41 pydora>=1,<2
42
43The easiest way to get started is by using the ``pandora.clientbuilder``
44package. This package contains a set of factories that can be used to build a
45Pandora client with some configuration. The classes in the package that end in
46``Builder`` are the factories and the rest of the classes are implementation
47details. All of the builders will return an instance of
48``pandora.client.APIClient`` that is completely configured and ready for use in
49your program.
50
51If you have an existing program and would like to connect to Pandora the
52easiest way is to use the ``SettingsDictBuilder`` class like so::
53
54 client = SettingsDictBuilder({
55 "DECRYPTION_KEY": "see_link_above",
56 "ENCRYPTION_KEY": "see_link_above",
57 "PARTNER_USER": "see_link_above",
58 "PARTNER_PASSWORD": "see_link_above",
59 "DEVICE": "see_link_above",
60 }).build()
61
62 client.login("username", "password")
63
64At this point the client is ready for use, see ``pandora.client.APIClient`` for
65a list of methods that can be called. All responses from the API will return
66Python objects from the ``pandora.models.pandora`` package or raise exceptions
67from ``pandora.errors``
68
69For a more functional example look at the file ``pydora/player.py`` which shows
70how to use the API in a simple command line application.
27 71
28Installing 72Installing
29========== 73==========