Skip to content

Commit a9bb5d0

Browse files
fix: Update readme (#39)
* Update errors raised when polling action attempts * Update authentication methods * Try using :code: for inline code markdown * Use double backtick for inline code snippets * Try :code: role for snippet in italics * Revert italic code text to backtick * Update README.rst Co-authored-by: Evan Sosenko <evan@getseam.com> * Update README.rst Co-authored-by: Evan Sosenko <evan@getseam.com> --------- Co-authored-by: Evan Sosenko <evan@getseam.com>
1 parent bf7e389 commit a9bb5d0

1 file changed

Lines changed: 42 additions & 11 deletions

File tree

README.rst

Lines changed: 42 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,11 @@ Unlock a door
7171
Authentication Method
7272
~~~~~~~~~~~~~~~~~~~~~
7373

74-
The SDK supports API key authentication mechanism.
74+
The SDK supports API key and personal access token authentication mechanisms.
75+
Authentication may be configured by passing the corresponding options directly to the ``Seam`` constructor, or with the more ergonomic static factory methods.
76+
77+
API Key
78+
^^^^^^^
7579

7680
An API key is scoped to a single workspace and should only be used on the server.
7781
Obtain one from the Seam Console.
@@ -87,14 +91,38 @@ Obtain one from the Seam Console.
8791
# Pass as a keyword argument to the constructor
8892
seam = Seam(api_key="your-api-key")
8993
94+
# Use the factory method
95+
seam = Seam.from_api_key("your-api-key")
96+
97+
Personal Access Token
98+
^^^^^^^^^^^^^^^^^^^^^
99+
100+
A Personal Access Token is scoped to a Seam Console user.
101+
Obtain one from the Seam Console.
102+
A workspace id must be provided when using this method and all requests will be scoped to that workspace.
103+
104+
.. code-block:: python
105+
106+
# Pass as an option the constructor
107+
seam = Seam(
108+
personal_access_token="your-personal-access-token",
109+
workspace_id="your-workspace-id",
110+
)
111+
112+
# Use the factory method
113+
seam = Seam.from_personal_access_token(
114+
"your-personal-access-token",
115+
"your-workspace-id",
116+
)
117+
90118
Action Attempts
91119
~~~~~~~~~~~~~~~
92120

93121
Some asynchronous operations, e.g., unlocking a door, return an `action attempt <https://docs.seam.co/latest/core-concepts/action-attempts>`_.
94122
Seam tracks the progress of requested operation and updates the action attempt.
95123

96124
To make working with action attempts more convenient for applications,
97-
this library provides the `wait_for_action_attempt` option.
125+
this library provides the ``wait_for_action_attempt`` option.
98126

99127
Pass the option per-request,
100128

@@ -126,19 +154,22 @@ and want to wait for it to resolve, simply use
126154
wait_for_action_attempt=True,
127155
)
128156
129-
Using the `wait_for_action_attempt` option:
157+
Using the ``wait_for_action_attempt`` option:
130158

131-
- Polls the action attempt up to the `timeout`
132-
at the `polling_interval` (both in seconds).
159+
- Polls the action attempt up to the ``timeout``
160+
at the ``polling_interval`` (both in seconds).
133161
- Resolves with a fresh copy of the successful action attempt.
134-
- Raises an exception if the action attempt is unsuccessful.
135-
- Raises an exception if the action attempt is still pending when the `timeout` is reached.
162+
- Raises a ``SeamActionAttemptFailedError`` if the action attempt is unsuccessful.
163+
- Raises a ``SeamActionAttemptTimeoutError`` if the action attempt is still pending when the ``timeout`` is reached.
164+
- Both errors expose an ``action_attempt`` property.
136165

137166
.. code-block:: python
138167
168+
from seam import Seam, SeamActionAttemptFailedError, SeamActionAttemptTimeoutError
169+
139170
seam = Seam("your-api-key")
140171
141-
lock = seam.locks.list()[0]
172+
lock = seam.locks.list()
142173
143174
if len(locks) == 0:
144175
raise Exception("No locks in this workspace")
@@ -169,7 +200,7 @@ Setting the endpoint
169200
Some contexts may need to override the API endpoint,
170201
e.g., testing or proxy setups.
171202

172-
Either pass the `api_url` option to the constructor, or set the `SEAM_ENDPOINT` environment variable.
203+
Either pass the ``api_url`` option to the constructor, or set the ``SEAM_ENDPOINT`` environment variable.
173204

174205
Development and Testing
175206
-----------------------
@@ -189,7 +220,7 @@ Run each command below in a separate terminal window:
189220

190221
$ make watch
191222

192-
Primary development tasks are defined in the `Makefile`.
223+
Primary development tasks are defined in the ``Makefile``.
193224

194225
Source Code
195226
~~~~~~~~~~~
@@ -260,7 +291,7 @@ Manual
260291
^^^^^^
261292

262293
Publish a new version by triggering a `version workflow_dispatch on GitHub Actions`_.
263-
The `version` input will be passed as the first argument to `poetry version`_.
294+
The ``version`` input will be passed as the first argument to `poetry version`_.
264295

265296
This may be done on the web or using the `GitHub CLI`_ with
266297

0 commit comments

Comments
 (0)