Skip to content

Commit

Permalink
release v0.5
Browse files Browse the repository at this point in the history
  • Loading branch information
snarfed committed Dec 10, 2023
1 parent a404aa2 commit 21ed6c2
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 8 deletions.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ output = client.com.example.my_procedure({'foo': 'bar'}, baz=5)

Note that `-` characters in method NSIDs are converted to `_`s, eg the call above is for the method `com.example.my-procedure`.

To call a method with non-JSON (eg binary) input, pass `bytes` to the call instead of a `dict`, and pass the content type with `headers={'Content-Type': '...'}`.

[Event stream methods](https://atproto.com/specs/event-stream) with type `subscription` are generators that `yield` (header, payload) tuples sent by the server. They take parameters as kwargs, but no positional `input`.

```py
Expand Down Expand Up @@ -228,6 +230,14 @@ Here's how to package, test, and ship a new release.
## Changelog
### 0.5 - 2023-12-10
* `Client`:
* Support binary request data automatically based on input type, eg `dict` vs `bytes`.
* Add new `headers` kwarg to `call` and auto-generated lexicon method calls, useful for providing an explicit `Content-Type` when sending binary data.
* Bug fix: don't infinite loop if `refreshSession` fails.
* Other minor authentication bug fixes.
### 0.4 - 2023-10-28
* Bundle [the official lexicons](https://github.com/bluesky-social/atproto/tree/main/lexicons/) for `app.bsky` and `com.atproto`, use them by default.
Expand Down
4 changes: 2 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,9 @@
# built documents.
#
# The short X.Y version.
version = '0.4'
version = '0.5'
# The full version, including alpha/beta/rc tags.
release = '0.4'
release = '0.5'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
31 changes: 26 additions & 5 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ schemas.
Install from `PyPI <https://pypi.org/project/lexrpc/>`__ with
``pip install lexrpc`` or ``pip install lexrpc[flask]``.

License: This project is placed in the public domain.
License: This project is placed in the public domain. You may also use
it under the `CC0
License <https://creativecommons.org/publicdomain/zero/1.0/>`__.

- `Client <#client>`__
- `Server <#server>`__
Expand Down Expand Up @@ -71,6 +73,10 @@ or use custom lexicons by passing them to the ``Client`` constructor:
Note that ``-`` characters in method NSIDs are converted to ``_``\ s, eg
the call above is for the method ``com.example.my-procedure``.

To call a method with non-JSON (eg binary) input, pass ``bytes`` to the
call instead of a ``dict``, and pass the content type with
``headers={'Content-Type': '...'}``.

`Event stream methods <https://atproto.com/specs/event-stream>`__ with
type ``subscription`` are generators that ``yield`` (header, payload)
tuples sent by the server. They take parameters as kwargs, but no
Expand Down Expand Up @@ -315,6 +321,21 @@ Here’s how to package, test, and ship a new release.
Changelog
---------

0.5 - 2023-12-10
~~~~~~~~~~~~~~~~

- ``Client``:

- Support binary request data automatically based on input type, eg
``dict`` vs ``bytes``.
- Add new ``headers`` kwarg to ``call`` and auto-generated lexicon
method calls, useful for providing an explicit ``Content-Type``
when sending binary data.
- Bug fix: don’t infinite loop if ``refreshSession`` fails.
- Other minor authentication bug fixes.

.. _section-1:

0.4 - 2023-10-28
~~~~~~~~~~~~~~~~

Expand All @@ -339,7 +360,7 @@ Changelog
``User-Agent: lexrpc (https://lexrpc.readthedocs.io/)`` request
header.

- ``server``:
- ``Server``:

- Add new ``Redirect`` class. Handlers can raise this to indicate
that the web server should serve an HTTP redirect. `Whether this
Expand All @@ -354,7 +375,7 @@ Changelog
- Add the ``error`` field to the JSON response bodies for most error
responses.

.. _section-1:
.. _section-2:

0.3 - 2023-08-29
~~~~~~~~~~~~~~~~
Expand All @@ -366,7 +387,7 @@ Changelog
- Add new ``Server.register`` method for manually registering handlers.
- Bug fix for server ``@method`` decorator.

.. _section-2:
.. _section-3:

0.2 - 2023-03-13
~~~~~~~~~~~~~~~~
Expand All @@ -383,7 +404,7 @@ put more effort into matching and fully implementing them. Stay tuned!
format <https://github.com/snarfed/atproto/commit/63b9873bb1699b6bce54e7a8d3db2fcbd2cfc5ab>`__.
Original format is no longer supported.

.. _section-3:
.. _section-4:

0.1 - 2022-12-13
~~~~~~~~~~~~~~~~
Expand Down
3 changes: 3 additions & 0 deletions lexrpc/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,8 @@ def call(self, nsid, input=None, headers={}, **params):
Args:
nsid (str): method NSID
input (dict or bytes): input body, optional for subscriptions
headers (dict): HTTP headers to include in this request. Overrides any
headers passed to the constructor.
params: optional method parameters
Returns:
Expand All @@ -135,6 +137,7 @@ def call(self, nsid, input=None, headers={}, **params):
output don't validate against the method's schemas
requests.RequestException: if the connection or HTTP request to the
remote server failed
"""
def loggable(val):
return f'{len(val)} bytes' if isinstance(val, bytes) else val
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ where = ['.']

[project]
name = 'lexrpc'
version = '0.4'
version = '0.5'
authors = [
{ name='Ryan Barrett', email='lexrpc@ryanb.org' },
]
Expand Down

0 comments on commit 21ed6c2

Please sign in to comment.