PyBeamIt
This is a python wrapper around the unofficial just beam it API. It supports both sending and receiving files.
Usage
Integrating P2P file sharing capability in your application is extremely simple.
First, install requirements with
pip install -r requirements.txt
Then on the sender's machine:
from pybeamit import JustBeamIt
j = JustBeamIt("file.wav")
#or for multiple files:
j = JustBeamIt(("file.wav", "file2.mp3"))
t=j.tokenise()
print("retrieval url for recipient: "+t)
print("waiting for recipient...")
j.wait()
print("starting the transfer")
j.transfer()
print("done")
On the receiving end:
from pybeamit import JustBeamIt
url = "" # e.g. https://www.justbeamit.com/s8x9j
j = JustBeamIt()
j.download(url, path="dest")
There are also a couple demos.
All operations require a JustBeamIt object:
class JustBeamIt(files=[], base_url=None, backend_url=None)
Once you have an instance, the following methods are defined:
tokenise()
Initiates the transfer with a backend server, returning a URL for download.
note: This must be called on the sender's machine.
wait()
Blocks until a recipient is available to receive the file.
transfer(progress_callback=None)
Perform the transfer, blocking until complete.
progress_callback will be called internally with one parameter, percentage
note: As of version 0.3, wait must be called first to ensure the other peer is ready to receive the file.
download(self, url_or_token, path=None, progress_callback=None, chunk_size=1024)
Blocking function that initiates a download.
The downloaded file will be saved in path (if provided) otherwise the current directory.
progress_callback will be called internally with one parameter, the percentage of the transfer (0-100).
contributing
Contributions are appreciated, thanks for your interest! Submit issues through the tracker. New features are accepted through PRs.
see also
Release files for PyBeamIt 0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| PyBeamIt-0.4.tar.gz | 4.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| PyBeamIt-0.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 9.3 kB
Release files / PyBeamIt-0.4.tar.gz
| Download URL | PyBeamIt-0.4.tar.gz |
|---|---|
| Size | 4.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bf2be011996923bb041c2140110b34fbf586504e027c16b215a73e03c5b258a5
|
|
BLAKE2b-256 checksum How to use checksums |
a11157df6fca72500b231c2304abb6ca08fb8bc395409d24a9ab4ff752c3e029
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.8.6
|
Release files / PyBeamIt-0.4-py3-none-any.whl
| Download URL | PyBeamIt-0.4-py3-none-any.whl |
|---|---|
| Size | 5.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5d685070c7e62ed39ab32c46718ac032b7d6cadd4e85afbe97745e46a7f612ea
|
|
BLAKE2b-256 checksum How to use checksums |
d4dc662bb027a731fcb4e4a93fdb94a636ecb241a8cda3993733b2df36d196f0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.8.6
|