Skip to main content

An API for HP2P Peer

Project description

hp2p-api

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: hp2p-api-1.0.7.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.7.tar.gz
Algorithm Hash digest
SHA256 594dc02f35c6e9d1117ac4681f8b5450479807f0c38705604ce105b98a07cbbf
MD5 a76a21ca2a916bfa46f6ea35e83480a8
BLAKE2b-256 4f8999eb2433e790d7022ed8b509b17463e9216c8bb3cc03313568a50a6d84d3

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hp2p_api-1.0.7-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.7-py3-none-any.whl
Algorithm Hash digest
SHA256 333e0b2b54efa5b5e771774d1a707814d59e91da79006c448f9a302801c3ee9b
MD5 05a2a74815eea60354c0d884ae605f94
BLAKE2b-256 cd308c2f0878ad1505c2a8788f15d3803253a569a8d3082a4de461f48a0f0f79

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