High level client library.
Project description
Nostr SDK - Python Package
Description
A high-level, Nostr client library.
If you're writing a typical Nostr client or bot, this is likely the crate you need.
However, the crate is designed in a modular way and depends on several other lower-level libraries. If you're attempting something more custom, you might be interested in these:
nostr-protocol
: Implementation of Nostr protocol
Getting started
pip install nostr-sdk
from nostr_sdk import Keys, Client, EventBuilder, Filter
import time
keys = Keys.generate()
print(keys.public_key().to_bech32())
client = Client(keys)
client.add_relay("wss://relay.damus.io")
client.connect()
print("Mining a POW text note...")
event = EventBuilder.new_text_note("Hello from Rust Nostr Python bindings!", []).to_pow_event(keys, 20)
event_id = client.send_event(event)
print("Event sent:")
print(f" hex: {event_id.to_hex()}")
print(f" bech32: {event_id.to_bech32()}")
time.sleep(2.0)
print("Getting events from relays...")
filter = Filter().authors([keys.public_key().to_hex()])
events = client.get_events_of([filter], None)
for event in events:
print(event.as_json())
More examples can be found at:
- https://github.com/rust-nostr/nostr/tree/master/bindings/nostr-ffi/bindings-python/examples
- https://github.com/rust-nostr/nostr/tree/master/bindings/nostr-sdk-ffi/bindings-python/examples
Supported NIPs
Look at https://github.com/rust-nostr/nostr/tree/master/crates/nostr#supported-nips
State
This library is in an ALPHA state, things that are implemented generally work but the API will change in breaking ways.
License
This project is distributed under the MIT software license - see the LICENSE file for details
Donations
⚡ Tips: https://getalby.com/p/yuki
⚡ Lightning Address: yuki@getalby.com
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Hashes for nostr_sdk-0.6.0-cp312-cp312-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cd86a64f04ce1338e64ba55fcd9a4c34d80f85294298b9586e1ea6c0fde921ac |
|
MD5 | 52a2ad26dafc0fdd7b338f2e4848fd5c |
|
BLAKE2b-256 | 4bdf6d1e6145276ab36888d66c27622c6d07639709fd372eb6c0c008323519e4 |
Hashes for nostr_sdk-0.6.0-cp312-cp312-manylinux_2_31_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1505a4d1e14790276dbb1c43c7f20613b00244998d1a263e86e98bcf2c1438e2 |
|
MD5 | 4aa9c709d320b302ac3c2d4281b4f2e7 |
|
BLAKE2b-256 | af3a00255d782e85651458a872cf0df66627707519d1b6d53e46e8743b047a3f |
Hashes for nostr_sdk-0.6.0-cp312-cp312-manylinux_2_17_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5bf86e83f3884d155e7c8e7dbd9c979171bc2c9286a7d330bd7a84397ec2a943 |
|
MD5 | d4e845889656f8827195ac712f9bc001 |
|
BLAKE2b-256 | 3082d4ca45b1d643ad0ec9d11da136c7909ec78628882f171ac0c19f494e1833 |
Hashes for nostr_sdk-0.6.0-cp312-cp312-macosx_11_0_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4a28d3a476f113452bd63a8ffd2f1a9305b2e99bfd356a94c8d4b06a8714e814 |
|
MD5 | 46031cd01d24c36a98461b2cefecef67 |
|
BLAKE2b-256 | 7c1d664d624a9ae80b682de0ea1c174e1b8ebcf685b08db3a0e2647776446bff |
Hashes for nostr_sdk-0.6.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 26e77717ba35d2b922c36462c2ad9356df1e6ebe97507d920f03ec6e6dc359d5 |
|
MD5 | 407ee1f57875d3c05ea310259d7c9848 |
|
BLAKE2b-256 | 306d84cad2b3f1bf7fdbc9097fd0d42dd29a98767ea062780dfb37473b96fbb6 |
Hashes for nostr_sdk-0.6.0-cp311-cp311-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 408aff593c5b1b4fd9020d2288975781309e2d074cf88c7c73dca496f4a84ce2 |
|
MD5 | 137000ee22f9e6f6a91e527cdea80f20 |
|
BLAKE2b-256 | 2efe8973120c7775638a49f5bc83fb950f77211f89e09be4725e7212268510f6 |
Hashes for nostr_sdk-0.6.0-cp311-cp311-manylinux_2_31_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e39d32fa0af381c24f7b216d9964364e5d889e6f0010cb9e8c1ba4f2c0b09adc |
|
MD5 | b4f5b381399a2ebdd9fdaab156425075 |
|
BLAKE2b-256 | ae2698a7043d0e00c8c9aa65c3eb84a4f2148b7e4537d4be0002bff6650b5279 |
Hashes for nostr_sdk-0.6.0-cp311-cp311-manylinux_2_17_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ed61e0d79a9b295945efa920e8f8f6da4f400a1a7d7a01f234c8b09e3223cd9f |
|
MD5 | 6b56fdf4c31626ca52098b3fc536c4bb |
|
BLAKE2b-256 | 1a6174f8e83dfdc87b36af7719d7e5d978088722149998a201695f67351455c8 |
Hashes for nostr_sdk-0.6.0-cp311-cp311-macosx_11_0_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7952d617e22ee61a149e5980c9dcba62c2c9154affd84994fb1b942bbb163913 |
|
MD5 | 809e8b22da9de06d7c1a006823de4dd0 |
|
BLAKE2b-256 | f78bff7eaa442a57e8c3c70cc9e657e67faecf5787c4e3a8c19b368c25e004fd |
Hashes for nostr_sdk-0.6.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 99c21aeced7b27ce91446a1eacd73c31dd58781a1135942c19580f83ea2a0861 |
|
MD5 | db6bffc30f95535353706d819b2a85a5 |
|
BLAKE2b-256 | 3106472439f551151e6737dd90bb7bda93e9ab12671d3ecbbaa6cb32a118b254 |
Hashes for nostr_sdk-0.6.0-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 893e1ef7ab8eb5aa32b28b51114a8c9e92d010b9f76f1e85aa2c962ed4ced0f8 |
|
MD5 | a5b85684e2970ed2b12c3a57ae12e4a3 |
|
BLAKE2b-256 | 4c5d957676be0c092eb6e19e8ff6258bba7292b0042bf9bc170fd0aa86b24eb2 |
Hashes for nostr_sdk-0.6.0-cp310-cp310-manylinux_2_31_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 100326ffc21a8ebd4b62e6b158b68c5bad08b9ad6a3f2e13106e4fa6fdb693f2 |
|
MD5 | 396c705e8451ea56d08c1970a0b3ef05 |
|
BLAKE2b-256 | 632042fc574693e245496eed4890e4fa63b94bf66aa4069727f6442def0c5e53 |
Hashes for nostr_sdk-0.6.0-cp310-cp310-manylinux_2_17_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | aba6ec2d897d1ed65656100a9320d66fe20f0a4a5e06985de553d34a5c203d4f |
|
MD5 | 38e3ac86fa133c48fb79decdd7285be7 |
|
BLAKE2b-256 | 948a4a84bfeb915c863ad7edeee80bfe37df83d57862f936fa73b1df0c0473d6 |
Hashes for nostr_sdk-0.6.0-cp310-cp310-macosx_11_0_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | acc2b5cf1240d0dec90767363a263b90242484e21783c0e5a2cde4174d4f2f3c |
|
MD5 | 7c8ceebaf769696a99d7e82f337c3c44 |
|
BLAKE2b-256 | d697facb4b30c2cbf5e29d9e71d94175ee84b52844aa17b6ba923fc90b7cb4fe |
Hashes for nostr_sdk-0.6.0-cp310-cp310-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 47eafcb16ced4ec3d4910ed7301677b78d8e4f9b3128b81358060250f345ca98 |
|
MD5 | 03804ffd8cd643c5bbc54c7860996cb3 |
|
BLAKE2b-256 | 386de0f09d9975c07e425b0f079f18e18d1e4c8109f35ed867d62ee69ada75d4 |
Hashes for nostr_sdk-0.6.0-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6f44940e1a5a6be563d5ebf1c8bef27953ecb703ce4c252ed26df3bc6d951e2c |
|
MD5 | 4f5dd461d99868d71386ed8705e71846 |
|
BLAKE2b-256 | 15c4f79fc1ad40ffb49f05cef3bcb4e8bcb455c2022d44bf4555fe73ffa3ee4f |
Hashes for nostr_sdk-0.6.0-cp39-cp39-manylinux_2_31_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e1b26c293f6aaff25ea0d4a99b98a4de41b11fa29bb7f546c53bbc898ec1ebe2 |
|
MD5 | 70e426a27e711205fe2b247bf8d9252d |
|
BLAKE2b-256 | cc311014ff8056bf50edc16751cd9c7d7a6ffc9506e2f3cf5d77f1e90416bfb5 |
Hashes for nostr_sdk-0.6.0-cp39-cp39-manylinux_2_17_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 861b37249137d3708efdec125b3b530d99a3aa43f690bbcd5cb8c24ff4329d0b |
|
MD5 | 3a452a216dbe79e9f933f353199bd593 |
|
BLAKE2b-256 | 54f674ce8e5d3f8ad58fda784494ca261db018534912cc291907373735f1a79a |
Hashes for nostr_sdk-0.6.0-cp39-cp39-macosx_11_0_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fd4383da5d40754a9b7918abbcc74170daf82943fc7a05dd159c96b115d96262 |
|
MD5 | b88413e4e7694e32a4b45ce08e814b42 |
|
BLAKE2b-256 | cc38c2ccbfd8f371925e8c22806d8f8d35a0f1ad238637e959e198d166fdf1db |
Hashes for nostr_sdk-0.6.0-cp39-cp39-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a93b6709f37388e1f84d38483b17cf000d4c0e642edec47366e19f27e37535fd |
|
MD5 | 56cb3c34f28b268e0c592a6a16f8c0cb |
|
BLAKE2b-256 | 9b4fefcfff69ef9bc75d3abeef4a83678b521cda175d6b626c461fce111bde0f |
Hashes for nostr_sdk-0.6.0-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3beb7f60a3698eb9e21b182081fe409a48c0d91d77c3ba59f042916e4b9ac149 |
|
MD5 | 91b7a8edac080acdfaaa934657d7e3ff |
|
BLAKE2b-256 | 519e12d134684b5fecdd95e2d2b10d9369098b927dcfbb4d5e840a9165adc89c |
Hashes for nostr_sdk-0.6.0-cp38-cp38-manylinux_2_31_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 996013bfc21cba58cb88e3c62a44200d8261b384faae51be90ba2549ba12369c |
|
MD5 | d98777d0eb38ea109b91311ae5bc0676 |
|
BLAKE2b-256 | e18b0e8b085a8c77aef31aedd4170906c668e8c9a66f96793d86c9fad32a378b |
Hashes for nostr_sdk-0.6.0-cp38-cp38-manylinux_2_17_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 20a172ec58f9a72c497d98096fc060beddbee8e2573e943f9e295912b136f3dd |
|
MD5 | 73cdda9ad9e5a11c6a506af0dcb71149 |
|
BLAKE2b-256 | 6261f8da7f23ebc986801abd62890328b855ac2252d210b3c3967d7ea490d000 |
Hashes for nostr_sdk-0.6.0-cp38-cp38-macosx_11_0_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f75690e75d59c9eeb060f1b275d259d867f0e0e62ceca7e1ad1c17893c81cb45 |
|
MD5 | 420d9a1d3c6b6a61ee062b1049fe63af |
|
BLAKE2b-256 | eb53195e666c97c84e4d5ce04ce51df06126aa02c541469892fe0bc58a871f38 |
Hashes for nostr_sdk-0.6.0-cp38-cp38-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 954b56b55a17c26bb9b1a7897e43048dc5b7380deff09402209231ca61244558 |
|
MD5 | 1d08135b6d418ba26f1ce97545ecb1cb |
|
BLAKE2b-256 | 251b3280fbbe1abad1e85e7f9af954cf1362f6e82add735a80d5a95935e5f598 |