Skip to main content

python wrapper around the just beam it file sharing API

Project description

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

Project details


Release history Release notifications | RSS feed

This version

0.4

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

PyBeamIt-0.4.tar.gz (4.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

PyBeamIt-0.4-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

Details for the file PyBeamIt-0.4.tar.gz.

File metadata

  • Download URL: PyBeamIt-0.4.tar.gz
  • Upload date:
  • Size: 4.0 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for PyBeamIt-0.4.tar.gz
Algorithm Hash digest
SHA256 bf2be011996923bb041c2140110b34fbf586504e027c16b215a73e03c5b258a5
MD5 d05f2bab3ce15c4e64e3f5c97d2ef527
BLAKE2b-256 a11157df6fca72500b231c2304abb6ca08fb8bc395409d24a9ab4ff752c3e029

See more details on using hashes here.

File details

Details for the file PyBeamIt-0.4-py3-none-any.whl.

File metadata

  • Download URL: PyBeamIt-0.4-py3-none-any.whl
  • Upload date:
  • Size: 5.3 kB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for PyBeamIt-0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 5d685070c7e62ed39ab32c46718ac032b7d6cadd4e85afbe97745e46a7f612ea
MD5 4024dc02e23bf743ae16d1d78535541e
BLAKE2b-256 d4dc662bb027a731fcb4e4a93fdb94a636ecb241a8cda3993733b2df36d196f0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page