https://github.com/eifinger/pyfoldingathomecontrol
Python lib to get stats from your Folding@Home clients.
https://github.com/eifinger/pyfoldingathomecontrol
asyncio hacktoberfest python python3
Last synced: about 1 year ago
JSON representation
Python lib to get stats from your Folding@Home clients.
- Host: GitHub
- URL: https://github.com/eifinger/pyfoldingathomecontrol
- Owner: eifinger
- License: mit
- Created: 2020-03-26T16:26:41.000Z (about 6 years ago)
- Default Branch: main
- Last Pushed: 2023-06-05T23:56:42.000Z (about 3 years ago)
- Last Synced: 2025-03-22T11:51:09.783Z (about 1 year ago)
- Topics: asyncio, hacktoberfest, python, python3
- Language: Python
- Homepage:
- Size: 536 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# PyFoldingAtHomeControl
Python library to get stats from your Folding@Home Clients
[](https://github.com/eifinger/PyFoldingAtHomeControl/actions?workflow=Python+package)
[](https://pypi.python.org/pypi/PyFoldingAtHomeControl)
[](https://github.com/eifinger/PyFoldingAtHomeControl/blob/master/LICENSE)
[](https://codecov.io/gh/eifinger/PyFoldingAtHomeControl)
[](https://pepy.tech/project/pyfoldingathomecontrol)
## Installation
```bash
pip install PyFoldingAtHomeControl
```
## Usage
```python
import asyncio
from FoldingAtHomeControl import FoldingAtHomeController
from FoldingAtHomeControl import PyOnMessageTypes
def callback(message_type, data):
print(f"callback for: {message_type}: ", data)
async def cancel_task(task_to_cancel):
task_to_cancel.cancel()
await task_to_cancel
if __name__ == "__main__":
Controller = FoldingAtHomeController("localhost")
Controller.register_callback(callback)
loop = asyncio.get_event_loop()
task = loop.create_task(Controller.start())
try:
loop.run_until_complete(task)
except KeyboardInterrupt:
pass
finally:
print("Cancelling task")
try:
loop.run_until_complete(cancel_task(task))
except asyncio.CancelledError:
print("Closing Loop")
loop.close()
```