An API for HP2P Peer
Project description
hp2p-api
A Python API for HP2P Peer
Usage
- Install hp2p-api
$pip install hp2p-api
- 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
}
- Import the 'hp2p-api' in your Python file using the following statement:
import hp2papi as api
- 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file hp2p-api-1.0.9.tar.gz.
File metadata
- Download URL: hp2p-api-1.0.9.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f5c3d2a94fade3c7b2eea9c7f226b21f3b84ac4ef02b18b37fa36a837735674f
|
|
| MD5 |
b297d5100ba7215c60ec27ff83f7f176
|
|
| BLAKE2b-256 |
7e7b6c9752e21ffbae9455414123eba005a150ad277546de6f87a2e6ba39ee07
|
File details
Details for the file hp2p_api-1.0.9-py3-none-any.whl.
File metadata
- Download URL: hp2p_api-1.0.9-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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dc2957e1129ec02ff9d3dfd0068de840a100f9688a7304bec8c932c0908adb9c
|
|
| MD5 |
6402f8eb29ac8fc1b86757650b648f7d
|
|
| BLAKE2b-256 |
6a89dd5d68aeca78d8c67c2d3a8bebcc54c0b41abb6790fcbb4118c39cbba3a0
|