Skip to main content

An API for HP2P Peer

Project description

hp2p-api

An API for HP2P Peer

Usage

  1. Install hp2p-api
$pip install hp2p-api
  1. Edit or create 'clientconfig.json'. This file must be located in the same directory as the executable.
{
    "OVERLAY_SERVER_ADDR" : "http://127.0.0.1:8081",
    "SIGNALING_SERVER_ADDR" : "ws://127.0.0.1:8082",
    "LOG_LEVEL" : 2,
    "FILE_LOG" : false,
    "STDOUT_LOG" : true
}
  1. Import the 'hp2p-api' in your Python file using the following statement:
import hp2papi as api
  1. Use the api

API

SetPeerOption

Customize peer options as required.
Must be done before calling StartGrpcServer().

api.SetPeerOption(peerOption: PeerOption)

SetGrpcPort

Set the port for the gRPC server to use.
Must be done before calling StartGrpcServer().

api.SetGrpcPort(port: int)

StartGrpcServer

Start gRPC server. Returns false if the port is in use.

api.StartGrpcServer() -> bool

Cleanup

Stop the server and release all resources.

api.Cleanup()

SetNotificatonListene

Register a listener to receive changes in the session.

api.SetNotificatonListener(overlayId: str, peerId: str, func: Callable[[Notification], None]) -> bool

DelNotificatonListener

Remove the registered listener.

api.DelNotificatonListener(overlayId: str, peerId: str) -> bool

Creation

Create a new session.

api.Creation(request: api.CreationRequest) -> CreationResponse

Query

Search for the existing session.

api.Query(overlayId: str = None, title: str = None, description: str = None) -> QueryResponse

Modification

Modify the session.

api.Modification(request: api.ModificationRequest) -> Response

Join

Join the session.

api.Join(request: api.JoinRequest) -> JoinResponse

SearchPeer

Retrieve peers participating in the session.

api.SearchPeer(request: api.SearchPeerRequest) -> SearchPeerResponse

SendData

Send the data.

api.SendData(request: api.SendDataRequest) -> Response

Leave

Leave the session.

api.Leave(request: api.LeaveRequest) -> Response

Removal

Remove the session.

api.Removal(request: api.RemovalRequest) -> Response

LICENSE

The MIT License

Copyright (c) 2022 ETRI

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Project details


Download files

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

Source Distribution

hp2p-api-1.0.5.tar.gz (31.7 MB view details)

Uploaded Source

Built Distribution

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

hp2p_api-1.0.5-py3-none-any.whl (31.8 MB view details)

Uploaded Python 3

File details

Details for the file hp2p-api-1.0.5.tar.gz.

File metadata

  • Download URL: hp2p-api-1.0.5.tar.gz
  • Upload date:
  • Size: 31.7 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for hp2p-api-1.0.5.tar.gz
Algorithm Hash digest
SHA256 e8e03153ceb1084b5333a3ba1d137680110026dc41d372621d2efa9a5a6459e4
MD5 81efff3048a089a3ae337b9a5620e672
BLAKE2b-256 39103a82422073bfc462add26096a22f0c1876cd4452800b588fdbb917acd527

See more details on using hashes here.

File details

Details for the file hp2p_api-1.0.5-py3-none-any.whl.

File metadata

  • Download URL: hp2p_api-1.0.5-py3-none-any.whl
  • Upload date:
  • Size: 31.8 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for hp2p_api-1.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 fb91b8f6dfd3854063a187d072055a389d48fae6edc2bc944103506ceeba9ff2
MD5 afc15e5479420e7e4a24e80ca663dcba
BLAKE2b-256 dde5a5ed77c5759dfcecc1cb0149daffb9007b53607656568a5c42fdd5472b16

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