pip install nats-py
Added
- Added object store feature based on initial contribution by domderen (https://github.com/nats-io/nats.py/pull/452 || https://github.com/nats-io/nats.py/pull/446)
Upload example:
python
import nats
import asyncio
async def main():
nc = await nats.connect("locahost", name="object.py")
js = nc.jetstream()
obs = await js.create_object_store("nats-py-object-store")
object_name = 'my-file.mp4'
with open(object_name) as f:
await obs.put(object_name, f)
await nc.close()
if __name__ == '__main__':
asyncio.run(main())
Download example:
python
import nats
import asyncio
async def main():
nc = await nats.connect("localhost", name="object.py")
js = nc.jetstream()
obs = await js.object_store("nats-py-object-store")
files = await obs.list()
for f in files:
print(f.name, "-", f.size)
object_name = 'my-file.mp4'
with open("copy-"+object_name, 'w') as f:
await obs.get(object_name, f)
await nc.close()
if __name__ == '__main__':
asyncio.run(main())
- Updated the `WebSocketTransport` to detect the attempt to upgrade the connection to TLS by allanbank (https://github.com/nats-io/nats.py/pull/443)
Fixed
- Fixed example from jetstream pull subscriber sample by csuriano23 (https://github.com/nats-io/nats.py/pull/366)
- Fixed issue where protocol was changed for ws and wss if no port was
provided by bvanelli (https://github.com/nats-io/nats.py/pull/371)
- Fixed untreated error callbacks when using websockets by bvanelli (https://github.com/nats-io/nats.py/issues/361 || https://github.com/nats-io/nats.py/pull/375)
- Fixes to `next_msg` and tasks cancellation (https://github.com/nats-io/nats.py/pull/446)
Changed
- Updated signatures for 'servers' and 'discovered_servers' properties by jonchammer (https://github.com/nats-io/nats.py/pull/374)
- Move configs from setup.cfg into pyproject.toml by orsinium (https://github.com/nats-io/nats.py/pull/394)
- Forbid None for Msg.Metadata fields by orsinium (https://github.com/nats-io/nats.py/pull/401)
- Convert `republish` value into dataclass by orsinium (https://github.com/nats-io/nats.py/pull/405)
- Change the type of client_id to int by kkqy (https://github.com/nats-io/nats.py/pull/435)
- Raise asyncio.CancelledError back by charbonnierg (https://github.com/nats-io/nats.py/pull/378)
- Send credentials even if no_auth_required is set on INFO (https://github.com/nats-io/nats.py/pull/399)
- Add sid property to nats.aio.msg.Msg class by charbonnierg (https://github.com/nats-io/nats.py/pull/430)
- Add custom inbox prefix support for JS pull subscribe by alparslanavci (https://github.com/nats-io/nats.py/pull/419)
Internal changes
- Sort imports by orsinium (https://github.com/nats-io/nats.py/pull/385)
- Make all type annotations lazy by orsinium (https://github.com/nats-io/nats.py/pull/386)
- Use the new type annotations syntax by orsinium (https://github.com/nats-io/nats.py/pull/388)
- Fixed incorrect formatting in `.travis.yml` by WillCodeCo (https://github.com/nats-io/nats.py/pull/420)
New Contributors
* csuriano23 made their first contribution in https://github.com/nats-io/nats.py/pull/366
* jonchammer made their first contribution in https://github.com/nats-io/nats.py/pull/374
* WillCodeCo made their first contribution in https://github.com/nats-io/nats.py/pull/420
* allanbank made their first contribution in https://github.com/nats-io/nats.py/pull/443
* kkqy made their first contribution in https://github.com/nats-io/nats.py/pull/435
* alparslanavci made their first contribution in https://github.com/nats-io/nats.py/pull/419