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.4.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.4-py3-none-any.whl (31.8 MB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: hp2p-api-1.0.4.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.4.tar.gz
Algorithm Hash digest
SHA256 809f7e1c4677a30b5d3dd89b62288f2e1f103491d2a4f58e6af3577e952e3435
MD5 9842f66c7b3fbe6aa624e25ef7f2480d
BLAKE2b-256 d7ba3e43e93f63ebaf691f69687a57a2702728cb67f4f311ac17af4bc0459968

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hp2p_api-1.0.4-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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 07f7a1e3f211408b232ba1c0691f8cb3923da3909243cd62eb0620cdd4dd2a2d
MD5 63892c618d677da043db123e8504ea36
BLAKE2b-256 a216d8fdf6c0d993a60b8ff38d0ffabdf8d3901e3ffbe22161ee821364ecf50c

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