Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -283,3 +283,23 @@ Long term:

- The client currently inputs and outputs JSON dictionaries. Adding models would unlock features such as typing and validation.
- Add supporting functions to elevate customer experience (i.e. adding a funtion that surfaces IP address for a Droplet)

- Add supporting functions to elevate customer experience (i.e. adding a funtion that surfaces IP address for a Droplet)

### 🧩 Handling Error Codes

When using `pydo`, some API responses may include specific error codes.
To make debugging easier, you can catch and print these codes from exceptions.

**Example:**
```python
from pydo import Client
import os

client = Client(token=os.getenv("DIGITALOCEAN_TOKEN"))

try:
client.droplets.list()
except Exception as e:
print("Error code:", getattr(e, "code", "Unknown"))
print("Error message:", e)