# hp2p-api
A Python API for HP2P Peer
## Usage
1. Install hp2p-api
```
$pip install hp2p-api
```
2. 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
}
```
3. Import the 'hp2p-api' in your Python file using the following statement:
``` py
import hp2papi as api
```
4. Use the api
## API
#### SetPeerOption
Customize peer options as required.
Must be done before calling StartGrpcServer().
``` py
api.SetPeerOption(peerOption: PeerOption)
```
#### SetGrpcPort
Set the port for the gRPC server to use.
Must be done before calling StartGrpcServer().
``` py
api.SetGrpcPort(port: int)
```
#### StartGrpcServer
Start gRPC server. Returns false if the port is in use.
``` py
api.StartGrpcServer() -> bool
```
#### Cleanup
Stop the server and release all resources.
``` py
api.Cleanup()
```
#### SetNotificatonListene
Register a listener to receive changes in the session.
``` py
api.SetNotificatonListener(overlayId: str, peerId: str, func: Callable[[Notification], None]) -> bool
```
#### DelNotificatonListener
Remove the registered listener.
``` py
api.DelNotificatonListener(overlayId: str, peerId: str) -> bool
```
#### Creation
Create a new session.
``` py
api.Creation(request: api.CreationRequest) -> CreationResponse
```
#### Query
Search for the existing session.
``` py
api.Query(overlayId: str = None, title: str = None, description: str = None) -> QueryResponse
```
#### Modification
Modify the session.
``` py
api.Modification(request: api.ModificationRequest) -> Response
```
#### Join
Join the session.
``` py
api.Join(request: api.JoinRequest) -> JoinResponse
```
#### SearchPeer
Retrieve peers participating in the session.
``` py
api.SearchPeer(request: api.SearchPeerRequest) -> SearchPeerResponse
```
#### SendData
Send the data.
``` py
api.SendData(request: api.SendDataRequest) -> Response
```
#### Leave
Leave the session.
``` py
api.Leave(request: api.LeaveRequest) -> Response
```
#### Removal
Remove the session.
``` py
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.
Raw data
{
"_id": null,
"home_page": "https://github.com/ITU-T-SG11-Q8/Q.4102",
"name": "hp2p-api",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "hp2p, hp2p-api",
"author": "JAYB",
"author_email": "jaylee@jayb.kr",
"download_url": "https://files.pythonhosted.org/packages/d8/72/14cf461555481d5390e202d801dd61cbdf4dc1adda8a9f558bf3494ecc9c/hp2p-api-1.0.8.tar.gz",
"platform": null,
"description": "# hp2p-api\nA Python API for HP2P Peer\n## Usage\n\n1. Install hp2p-api\n```\n$pip install hp2p-api\n```\n2. Edit or create 'clientconfig.json'. This file must be located in the same directory as the executable. \n```\n{\n \"OVERLAY_SERVER_ADDR\" : \"http://127.0.0.1:8081\",\n \"SIGNALING_SERVER_ADDR\" : \"ws://127.0.0.1:8082\",\n \"LOG_LEVEL\" : 2,\n \"FILE_LOG\" : false,\n \"STDOUT_LOG\" : true\n}\n```\n3. Import the 'hp2p-api' in your Python file using the following statement:\n``` py\nimport hp2papi as api\n```\n4. Use the api \n\n## API \n#### SetPeerOption\nCustomize peer options as required. \nMust be done before calling StartGrpcServer().\n``` py\napi.SetPeerOption(peerOption: PeerOption)\n```\n#### SetGrpcPort\nSet the port for the gRPC server to use. \nMust be done before calling StartGrpcServer().\n``` py\napi.SetGrpcPort(port: int)\n```\n#### StartGrpcServer\nStart gRPC server. Returns false if the port is in use.\n``` py\napi.StartGrpcServer() -> bool\n```\n#### Cleanup\nStop the server and release all resources.\n``` py\napi.Cleanup()\n```\n#### SetNotificatonListene\nRegister a listener to receive changes in the session.\n``` py\napi.SetNotificatonListener(overlayId: str, peerId: str, func: Callable[[Notification], None]) -> bool\n```\n#### DelNotificatonListener\nRemove the registered listener.\n``` py\napi.DelNotificatonListener(overlayId: str, peerId: str) -> bool\n```\n#### Creation\nCreate a new session.\n``` py\napi.Creation(request: api.CreationRequest) -> CreationResponse\n```\n#### Query\nSearch for the existing session.\n``` py\napi.Query(overlayId: str = None, title: str = None, description: str = None) -> QueryResponse\n```\n#### Modification\nModify the session.\n``` py\napi.Modification(request: api.ModificationRequest) -> Response\n```\n#### Join\nJoin the session.\n``` py\napi.Join(request: api.JoinRequest) -> JoinResponse\n```\n#### SearchPeer\nRetrieve peers participating in the session.\n``` py\napi.SearchPeer(request: api.SearchPeerRequest) -> SearchPeerResponse\n```\n#### SendData\nSend the data.\n``` py\napi.SendData(request: api.SendDataRequest) -> Response\n```\n#### Leave\nLeave the session.\n``` py\napi.Leave(request: api.LeaveRequest) -> Response\n```\n#### Removal\nRemove the session.\n``` py\napi.Removal(request: api.RemovalRequest) -> Response\n```\n \n## LICENSE\n\nThe MIT License\n\nCopyright (c) 2022 ETRI\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n",
"bugtrack_url": null,
"license": null,
"summary": "An API for HP2P Peer",
"version": "1.0.8",
"project_urls": {
"Homepage": "https://github.com/ITU-T-SG11-Q8/Q.4102"
},
"split_keywords": [
"hp2p",
" hp2p-api"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "d3215dfa02e8ab6d063223a4180d82ddf0eb1a027642559ba289f777ee25145f",
"md5": "af2d175cde7bea4a390c2bf6272c78a8",
"sha256": "e9062dc748e44602d4d5e9d87a27b20c0dbb29bae6fb1b4c02fcc625527aba2b"
},
"downloads": -1,
"filename": "hp2p_api-1.0.8-py3-none-any.whl",
"has_sig": false,
"md5_digest": "af2d175cde7bea4a390c2bf6272c78a8",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 31805208,
"upload_time": "2024-05-09T10:26:14",
"upload_time_iso_8601": "2024-05-09T10:26:14.020999Z",
"url": "https://files.pythonhosted.org/packages/d3/21/5dfa02e8ab6d063223a4180d82ddf0eb1a027642559ba289f777ee25145f/hp2p_api-1.0.8-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "d87214cf461555481d5390e202d801dd61cbdf4dc1adda8a9f558bf3494ecc9c",
"md5": "0d14a8f672a6f4d6ea156b9fbebe76dd",
"sha256": "2162e388c05da0fbf081229cd1e6036e70bbf2be90f8b5f130f525a0bac485ac"
},
"downloads": -1,
"filename": "hp2p-api-1.0.8.tar.gz",
"has_sig": false,
"md5_digest": "0d14a8f672a6f4d6ea156b9fbebe76dd",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 31714347,
"upload_time": "2024-05-09T10:26:28",
"upload_time_iso_8601": "2024-05-09T10:26:28.592590Z",
"url": "https://files.pythonhosted.org/packages/d8/72/14cf461555481d5390e202d801dd61cbdf4dc1adda8a9f558bf3494ecc9c/hp2p-api-1.0.8.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-05-09 10:26:28",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "ITU-T-SG11-Q8",
"github_project": "Q.4102",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "hp2p-api"
}