diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 665aac8..2f11eeb 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -41,7 +41,7 @@ sdk/python/ 1. **Clone the repository:** ```bash - git clone https://github.com/TeoSlayer/pilotprotocol.git + git clone https://github.com/pilot-protocol/pilotprotocol.git cd pilotprotocol/sdk/python ``` diff --git a/README.md b/README.md index be7eb7a..a2e5ee1 100644 --- a/README.md +++ b/README.md @@ -32,18 +32,23 @@ pilotctl daemon start --hostname my-agent Then, from your code: ```python -from pilotprotocol import Driver - -with Driver() as d: - info = d.info() - print(f"address={info['address']}") - - d.set_hostname("my-python-agent") +from pilotprotocol import Driver, PilotError - peer = d.resolve_hostname("other-agent") - with d.dial(f"{peer['address']}:1000") as conn: - conn.write(b"hello") - print(conn.read(4096)) +try: + with Driver() as d: + info = d.info() + print(f"address={info['address']}") + + d.set_hostname("my-python-agent") + + peer = d.resolve_hostname("other-agent") + with d.dial(f"{peer['address']}:1000") as conn: + conn.write(b"hello") + print(conn.read(4096)) +except (PilotError, FileNotFoundError) as e: + # Raised when libpilot isn't installed or no daemon is running. + # Start one with: pilotctl daemon start --hostname my-agent + print(f"pilot daemon unavailable: {e}") ``` ## API overview @@ -65,7 +70,7 @@ from pilotprotocol import Driver, PilotError try: with Driver() as d: d.resolve_hostname("unknown") -except PilotError as e: +except (PilotError, FileNotFoundError) as e: print(f"error: {e}") ``` diff --git a/docs/BUILD_INSTRUCTIONS.md b/docs/BUILD_INSTRUCTIONS.md index 7870807..f8df5d1 100644 --- a/docs/BUILD_INSTRUCTIONS.md +++ b/docs/BUILD_INSTRUCTIONS.md @@ -50,7 +50,7 @@ pip install build twine ### 1. Clone the repository ```bash -git clone https://github.com/TeoSlayer/pilotprotocol.git +git clone https://github.com/pilot-protocol/pilotprotocol.git cd pilotprotocol/sdk/python ```