Metadata-Version: 2.4
Name: sessionpy-messenger
Version: 0.1.0
Summary: A Python client for Session Messenger
Author: SessionPy contributors
License-Expression: GPL-3.0-or-later
Project-URL: Homepage, https://github.com/fdsjklfsdjlkfdsjkl/sessionpy
Project-URL: Repository, https://github.com/fdsjklfsdjlkfdsjkl/sessionpy
Project-URL: Documentation, https://github.com/fdsjklfsdjlkfdsjkl/sessionpy#readme
Project-URL: Upstream, https://github.com/sessionjs/client
Project-URL: Foundation, https://github.com/PranThow/pysession-client
Keywords: session,messenger,python,client,e2ee
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Operating System :: OS Independent
Classifier: Topic :: Communications :: Chat
Classifier: Topic :: Security :: Cryptography
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: pynacl>=1.5.0
Requires-Dist: requests>=2.31.0
Requires-Dist: cryptography>=41.0.0
Provides-Extra: test
Requires-Dist: pytest>=8.0; extra == "test"
Dynamic: license-file

# SessionPy

A Python client for Session Messenger. It supports onion-routed 1:1 messaging,
polling, attachments, reactions, receipts, typing indicators,
disappearing-message metadata, profiles, and event-driven message handling.

## Install

```powershell
py -m pip install sessionpy-messenger
```

Python 3.10 or newer is required.

The PyPI distribution is named `sessionpy-messenger`; the Python import remains
`sessionpy`.

## Quick start

```python
from sessionpy import Poller, Session

session = Session()
session.set_mnemonic("your thirteen word Session recovery phrase ...")

print(session.get_session_id())

result = session.send_message(
    "05...recipient Session ID...",
    text="Hello from Python",
    attachments=["photo.png"],
)
print(result["message_hash"])

poller = session.add_poller(Poller(interval=None))
session.on("message", lambda message: print(message["body"]))
messages = poller.poll()
```

Intervals are seconds: `Poller(interval=5)` starts a background daemon thread;
call `poller.stop()` during shutdown. Use `interval=None` for explicit polling.

See [MIGRATION.md](MIGRATION.md) for API compatibility and port status. The
protocol internals are documented in
[ARCHITECTURE.md](ARCHITECTURE.md).

## Security notes

- Keep recovery phrases private; the wrapper never needs an account password.
- Service nodes use protocol-level identities and self-signed TLS certificates,
  matching Session's network design.
- Decryption fails closed: bad signatures, attachment MACs, and digests are
  rejected.

## Test

```powershell
py -m pip install -e ".[test]"
py -m pytest
python -m sessionpy.selftest
```

The unit tests and self-test are offline. Live network use requires access to
Session seed nodes, service nodes, and the Session file server.

## Attribution

SessionPy is an independent community project and is not affiliated with the
Session Technology Foundation. Its client API and protocol behavior were ported
with reference to the MIT-licensed
[`sessionjs/client`](https://github.com/sessionjs/client) project. Its
onion-routing and core Python protocol foundation derive from the
GPL-3.0-or-later [`PranThow/pysession-client`](https://github.com/PranThow/pysession-client)
project. The combined project is therefore distributed under GPL-3.0-or-later;
the original license and Git history are retained.
