🐝 Bee Py
📖 Table of Contents
🌐 Overview
This is the library for connecting to Bee decentralised storage using python.
✨ Features
- TODO
📋 Requirements
Python3.9+
🚀 Testing Locally
🛠️ Installation
You can install bee-py via [pip] from [PyPI]:
pip install swarm-bee-py
🚀 Usage
🐝 Bee Endpoint
from bee_py.bee import Bee
bee = Bee("https://18.134.10.41:1633")
# List Tags
all_tags = bee.get_all_tags({"limit": 1000})
print(all_tags)
>>> [Tag(split=0, seen=0, stored=0, sent=0, synced=6, uid=2270760008, started_at='2023-12-27T19:00:24Z', total=6, processed=6),
Tag(split=0, seen=0, stored=0, sent=0, synced=0, uid=2271272542, started_at='2023-12-09T13:22:52Z', total=0, processed=0),
Tag(split=0, seen=0, stored=0, sent=0, synced=3, uid=2272654825, started_at='2023-12-26T22:15:30Z', total=3, processed=3),
Tag(split=0, seen=0, stored=0, sent=0, synced=3, uid=2274652661, started_at='2023-12-19T20:27:27Z', total=3, processed=3),
Tag(split=0, seen=0, stored=0, sent=0, synced=4, uid=2274680401, started_at='2024-01-05T20:03:17Z', total=4, processed=4),
Tag(split=0, seen=0, stored=0, sent=0, synced=16, uid=2274738522, started_at='2023-12-27T00:12:46Z', total=16, processed=16),
Tag(split=0, seen=0, stored=0, sent=0, synced=6, uid=2277789382, started_at='2024-01-05T19:30:39Z', total=6, processed=6),
Tag(split=0, seen=0, stored=0, sent=0, synced=5, uid=2278169907, started_at='2023-12-27T00:44:34Z', total=5, processed=5),
Tag(split=0, seen=0, stored=0, sent=0, synced=1, uid=2278428847, started_at='2023-12-19T01:29:06Z', total=1, processed=1),
Tag(split=0, seen=0, stored=0, sent=0, synced=1, uid=2280360127, started_at='2023-12-27T16:18:04Z', total=1, processed=1)]
# Random Taken for example
batch_id = "eeba33ebe515c3ca9827a5e82e07987f813966fd39067126b120bcd6cd714ce9"
# Upload Data
upload_result = bee.upload_data(batch_id, "Bee is Awesome!")
print(upload_result)
>>> UploadResult(reference=Reference(value='b0d6b928d0f64fab1a50d37a965515cc6f152d3c27f58fbcefb6b8506f23b076'), tag_uid=None)
print(upload_result.reference)
>>> Reference(value='b0d6b928d0f64fab1a50d37a965515cc6f152d3c27f58fbcefb6b8506f23b076')
print(upload_result.reference.value)
>>> 'b0d6b928d0f64fab1a50d37a965515cc6f152d3c27f58fbcefb6b8506f23b076'
# Both can be done to obtain the reference value
print(str(upload_result.reference))
>>> 'b0d6b928d0f64fab1a50d37a965515cc6f152d3c27f58fbcefb6b8506f23b076'
data = bee.download_data(upload_result.reference.value)
print(data)
>>> Data(data=b'Bee is Awesome!')
# Data can be converted into json format, hex, bytes or plain-text
print(data.to_json())
>>> '{"data":"Bee is Awesome!"}'
print(data.text())
>>> 'Bee is Awesome!'
print(data.hex())
>>> '42656520697320417765736f6d6521'
🚀 Bee Debug Endpoint
from bee_py.bee_debug import BeeDebug
bee_debug = BeeDebug("https://18.134.10.41:1635")
# Be aware, this creates on-chain transactions that spend Eth and BZZ!
# Get Postage
batch_id = bee_debug.create_postage_batch('2000', 20)
print(batch_id)
>>> "17cbeb913ff852e34ade49c6df75adc7ff6f263b86d59c1cb2c3b0388cfe9cf3"
👩💻 Development
This project is developed using pdm. So the quickest way to get started is using pdm. Install pdm using pip, pipx etc & then follow the following steps
git clone https://github.com/alienrobotninja/bee-py
cd bee-py
# To install all the dev & lint dependencies
pdm install -G:all
That's it, you're environment is ready. Now install docker to run bee-factory. Now to start the bee-factory do bee-factory start --detach 1.15.0-rc2. As of 7th January 2024 1.15.0-rc2 is the latest release for bee-factory which uses a very outdated versions of bee.
🤝 Contributing
Contributions are very welcome. To learn more, see the Contributor Guide.
📄 License
Distributed under the terms of the GPL 3.0 license, Bee Py is free and open source software.
🐞 Issues
There are some know issues like:
- Some tests are perfomed on older versions of bee.
- Some tests are stuck for hours when using the latest Bee API(not
bee-pyissue). - Some tests are skipped because of outdated libraries used by various
ethersphereprojects.
If you encounter any problems, please [file an issue] along with a detailed description.
📚 Documentation
You can find the full documentation here. The API reference documentation can be found here.
👏 Credits
Developed by @Aviksaikat
Metadata
Release files for swarm-bee-py 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| swarm-bee-py-0.1.1.tar.gz | 69.8 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| swarm_bee_py-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 157.0 kB
Release files / swarm-bee-py-0.1.1.tar.gz
| Download URL | swarm-bee-py-0.1.1.tar.gz |
|---|---|
| Size | 69.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
53daee87e4c9c7de6046830049dea1772e82c03ce1ae12f7fa344c18aa2bda28
|
|
BLAKE2b-256 checksum How to use checksums |
ddf55547b7204c8cb64ad46be578099d3c18294c4da5005a66d3616f220257f0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.0
|
Release files / swarm_bee_py-0.1.1-py3-none-any.whl
| Download URL | swarm_bee_py-0.1.1-py3-none-any.whl |
|---|---|
| Size | 87.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ab82a922a3abfab17667270d2d04704c288271ac540dce1b7cde27f320b35dd2
|
|
BLAKE2b-256 checksum How to use checksums |
342c6c84417a38ff657a0066b80a1713cfe8ea0efc00f2608707c47fbdf7f047
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.0
|
Security for swarm-bee-py 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.