amigo_sdk 0.7.0__tar.gz → 0.9.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of amigo_sdk might be problematic. Click here for more details.

Files changed (54) hide show
  1. amigo_sdk-0.9.0/.github/workflows/auto-release.yml +181 -0
  2. {amigo_sdk-0.7.0 → amigo_sdk-0.9.0}/PKG-INFO +35 -47
  3. {amigo_sdk-0.7.0 → amigo_sdk-0.9.0}/README.md +34 -46
  4. amigo_sdk-0.9.0/openapi-new.json +1 -0
  5. amigo_sdk-0.9.0/specs/openapi-baseline.json +1 -0
  6. amigo_sdk-0.9.0/src/amigo_sdk/__init__.py +8 -0
  7. amigo_sdk-0.9.0/src/amigo_sdk/_retry_utils.py +70 -0
  8. amigo_sdk-0.9.0/src/amigo_sdk/auth.py +48 -0
  9. {amigo_sdk-0.7.0 → amigo_sdk-0.9.0}/src/amigo_sdk/generated/model.py +1 -5
  10. amigo_sdk-0.9.0/src/amigo_sdk/http_client.py +379 -0
  11. {amigo_sdk-0.7.0 → amigo_sdk-0.9.0}/src/amigo_sdk/resources/conversation.py +156 -4
  12. {amigo_sdk-0.7.0 → amigo_sdk-0.9.0}/src/amigo_sdk/resources/organization.py +15 -3
  13. {amigo_sdk-0.7.0 → amigo_sdk-0.9.0}/src/amigo_sdk/resources/service.py +21 -5
  14. {amigo_sdk-0.7.0 → amigo_sdk-0.9.0}/src/amigo_sdk/resources/user.py +43 -3
  15. {amigo_sdk-0.7.0 → amigo_sdk-0.9.0}/src/amigo_sdk/sdk_client.py +100 -18
  16. {amigo_sdk-0.7.0 → amigo_sdk-0.9.0}/tests/integration/test_conversation_integration.py +153 -10
  17. {amigo_sdk-0.7.0 → amigo_sdk-0.9.0}/tests/integration/test_organization_integration.py +83 -31
  18. amigo_sdk-0.9.0/tests/integration/test_user_integration.py +181 -0
  19. {amigo_sdk-0.7.0 → amigo_sdk-0.9.0}/tests/resources/helpers.py +154 -4
  20. amigo_sdk-0.9.0/tests/resources/test_conversation.py +882 -0
  21. amigo_sdk-0.9.0/tests/resources/test_organization.py +95 -0
  22. {amigo_sdk-0.7.0 → amigo_sdk-0.9.0}/tests/resources/test_service.py +37 -5
  23. {amigo_sdk-0.7.0 → amigo_sdk-0.9.0}/tests/resources/test_user.py +95 -5
  24. {amigo_sdk-0.7.0 → amigo_sdk-0.9.0}/tests/test_auth.py +70 -5
  25. amigo_sdk-0.9.0/tests/test_http_client.py +741 -0
  26. amigo_sdk-0.9.0/tests/test_retry_utils.py +86 -0
  27. {amigo_sdk-0.7.0 → amigo_sdk-0.9.0}/tests/test_sdk_client.py +59 -8
  28. amigo_sdk-0.7.0/.github/workflows/auto-release.yml +0 -107
  29. amigo_sdk-0.7.0/openapi-new.json +0 -1
  30. amigo_sdk-0.7.0/specs/openapi-baseline.json +0 -1
  31. amigo_sdk-0.7.0/src/amigo_sdk/__init__.py +0 -1
  32. amigo_sdk-0.7.0/src/amigo_sdk/auth.py +0 -30
  33. amigo_sdk-0.7.0/src/amigo_sdk/http_client.py +0 -228
  34. amigo_sdk-0.7.0/tests/integration/test_user_integration.py +0 -97
  35. amigo_sdk-0.7.0/tests/resources/test_conversation.py +0 -463
  36. amigo_sdk-0.7.0/tests/resources/test_organization.py +0 -60
  37. amigo_sdk-0.7.0/tests/test_http_client.py +0 -551
  38. {amigo_sdk-0.7.0 → amigo_sdk-0.9.0}/.github/workflows/release.yml +0 -0
  39. {amigo_sdk-0.7.0 → amigo_sdk-0.9.0}/.github/workflows/test.yml +0 -0
  40. {amigo_sdk-0.7.0 → amigo_sdk-0.9.0}/.gitignore +0 -0
  41. {amigo_sdk-0.7.0 → amigo_sdk-0.9.0}/CONTRIBUTING.md +0 -0
  42. {amigo_sdk-0.7.0 → amigo_sdk-0.9.0}/LICENSE +0 -0
  43. {amigo_sdk-0.7.0 → amigo_sdk-0.9.0}/pyproject.toml +0 -0
  44. {amigo_sdk-0.7.0 → amigo_sdk-0.9.0}/scripts/__init__.py +0 -0
  45. {amigo_sdk-0.7.0 → amigo_sdk-0.9.0}/scripts/aliases.json +0 -0
  46. {amigo_sdk-0.7.0 → amigo_sdk-0.9.0}/scripts/check.py +0 -0
  47. {amigo_sdk-0.7.0 → amigo_sdk-0.9.0}/scripts/gen_models.py +0 -0
  48. {amigo_sdk-0.7.0 → amigo_sdk-0.9.0}/src/amigo_sdk/config.py +0 -0
  49. {amigo_sdk-0.7.0 → amigo_sdk-0.9.0}/src/amigo_sdk/errors.py +0 -0
  50. {amigo_sdk-0.7.0 → amigo_sdk-0.9.0}/tests/__init__.py +0 -0
  51. {amigo_sdk-0.7.0 → amigo_sdk-0.9.0}/tests/conftest.py +0 -0
  52. {amigo_sdk-0.7.0 → amigo_sdk-0.9.0}/tests/resources/__init__.py +0 -0
  53. {amigo_sdk-0.7.0 → amigo_sdk-0.9.0}/tests/test_config.py +0 -0
  54. {amigo_sdk-0.7.0 → amigo_sdk-0.9.0}/tests/test_errors.py +0 -0
@@ -0,0 +1,181 @@
1
+ name: Auto Release (Backend API changes)
2
+
3
+ on:
4
+ repository_dispatch:
5
+ types: [openapi-updated]
6
+
7
+ permissions:
8
+ contents: write
9
+
10
+ jobs:
11
+ detect:
12
+ name: Detect OpenAPI change
13
+ runs-on: ubuntu-latest
14
+ outputs:
15
+ changed: ${{ steps.diff.outputs.changed }}
16
+ spec_url: ${{ steps.spec.outputs.spec_url }}
17
+ steps:
18
+ - uses: actions/checkout@v4
19
+
20
+ - name: Ensure jq
21
+ run: sudo apt-get update && sudo apt-get install -y jq
22
+
23
+ - name: Resolve spec URL
24
+ id: spec
25
+ run: |
26
+ SPEC_URL="${{ github.event.client_payload.spec_url }}"
27
+ if [ -z "$SPEC_URL" ]; then
28
+ SPEC_URL="https://api.amigo.ai/v1/openapi.json"
29
+ fi
30
+ echo "spec_url=$SPEC_URL" >> $GITHUB_OUTPUT
31
+
32
+ - name: Fetch current production spec
33
+ run: curl -fSL -o openapi-new.json "${{ steps.spec.outputs.spec_url }}"
34
+
35
+ - name: Check baseline presence
36
+ id: baseline
37
+ run: |
38
+ mkdir -p specs
39
+ if [ ! -f specs/openapi-baseline.json ]; then
40
+ echo "missing=true" >> $GITHUB_OUTPUT
41
+ else
42
+ echo "missing=false" >> $GITHUB_OUTPUT
43
+ fi
44
+
45
+ - name: Prepare baseline
46
+ run: |
47
+ mkdir -p specs
48
+ if [ ! -f specs/openapi-baseline.json ]; then
49
+ cp openapi-new.json specs/openapi-baseline.json
50
+ fi
51
+
52
+ - name: Diagnostics (spec and baseline)
53
+ run: |
54
+ echo "Resolved spec_url: ${{ steps.spec.outputs.spec_url }}"
55
+ echo "Baseline missing: ${{ steps.baseline.outputs.missing }}"
56
+ echo "jq version: $(jq --version)"
57
+ jq -S '
58
+ def sort_deep:
59
+ if type == "array" then
60
+ map(sort_deep) | sort_by(tostring)
61
+ elif type == "object" then
62
+ with_entries(.value |= sort_deep)
63
+ else . end;
64
+ (del(.info) | del(.servers)) | sort_deep
65
+ ' specs/openapi-baseline.json > baseline.norm.json || true
66
+ jq -S '
67
+ def sort_deep:
68
+ if type == "array" then
69
+ map(sort_deep) | sort_by(tostring)
70
+ elif type == "object" then
71
+ with_entries(.value |= sort_deep)
72
+ else . end;
73
+ (del(.info) | del(.servers)) | sort_deep
74
+ ' openapi-new.json > new.norm.json
75
+ if [ -f baseline.norm.json ]; then
76
+ echo "BASELINE_NORM_SHA=$(sha256sum baseline.norm.json | awk '{print $1}')"
77
+ else
78
+ echo "BASELINE_NORM_SHA=(none)"
79
+ fi
80
+ echo "NEW_NORM_SHA=$(sha256sum new.norm.json | awk '{print $1}')"
81
+ if [ -f baseline.norm.json ]; then
82
+ if diff -q baseline.norm.json new.norm.json >/dev/null 2>&1; then
83
+ echo "Quick diff: identical"
84
+ else
85
+ echo "Quick diff: differs"
86
+ fi
87
+ fi
88
+
89
+ # Section-level hashes and key diffs
90
+ echo "\n== Section-level hashes =="
91
+ if [ -f specs/openapi-baseline.json ]; then
92
+ BASELINE_PATHS_SHA=$(jq -cS '(.paths // {})' specs/openapi-baseline.json | sha256sum | awk '{print $1}')
93
+ BASELINE_SCHEMAS_SHA=$(jq -cS '(.components.schemas // {})' specs/openapi-baseline.json | sha256sum | awk '{print $1}')
94
+ BASELINE_PATHS_COUNT=$(jq -r '(.paths // {}) | keys | length' specs/openapi-baseline.json)
95
+ BASELINE_SCHEMAS_COUNT=$(jq -r '(.components.schemas // {}) | keys | length' specs/openapi-baseline.json)
96
+ else
97
+ BASELINE_PATHS_SHA=(none)
98
+ BASELINE_SCHEMAS_SHA=(none)
99
+ BASELINE_PATHS_COUNT=0
100
+ BASELINE_SCHEMAS_COUNT=0
101
+ fi
102
+ NEW_PATHS_SHA=$(jq -cS '(.paths // {})' openapi-new.json | sha256sum | awk '{print $1}')
103
+ NEW_SCHEMAS_SHA=$(jq -cS '(.components.schemas // {})' openapi-new.json | sha256sum | awk '{print $1}')
104
+ NEW_PATHS_COUNT=$(jq -r '(.paths // {}) | keys | length' openapi-new.json)
105
+ NEW_SCHEMAS_COUNT=$(jq -r '(.components.schemas // {}) | keys | length' openapi-new.json)
106
+ echo "BASELINE paths: count=$BASELINE_PATHS_COUNT sha=$BASELINE_PATHS_SHA"
107
+ echo "NEW paths: count=$NEW_PATHS_COUNT sha=$NEW_PATHS_SHA"
108
+ echo "BASELINE schemas: count=$BASELINE_SCHEMAS_COUNT sha=$BASELINE_SCHEMAS_SHA"
109
+ echo "NEW schemas: count=$NEW_SCHEMAS_COUNT sha=$NEW_SCHEMAS_SHA"
110
+
111
+ echo "\n== Key diffs (paths) =="
112
+ if [ -f specs/openapi-baseline.json ]; then
113
+ jq -r '(.paths // {}) | keys | sort[]' specs/openapi-baseline.json > baseline.paths.txt || true
114
+ else
115
+ : > baseline.paths.txt
116
+ fi
117
+ jq -r '(.paths // {}) | keys | sort[]' openapi-new.json > new.paths.txt
118
+ echo "Removed paths (in baseline, not in new):"; comm -23 baseline.paths.txt new.paths.txt || true
119
+ echo "Added paths (in new, not in baseline):"; comm -13 baseline.paths.txt new.paths.txt || true
120
+
121
+ echo "\n== Key diffs (components.schemas) =="
122
+ if [ -f specs/openapi-baseline.json ]; then
123
+ jq -r '(.components.schemas // {}) | keys | sort[]' specs/openapi-baseline.json > baseline.schemas.txt || true
124
+ else
125
+ : > baseline.schemas.txt
126
+ fi
127
+ jq -r '(.components.schemas // {}) | keys | sort[]' openapi-new.json > new.schemas.txt
128
+ echo "Removed schemas (in baseline, not in new):"; comm -23 baseline.schemas.txt new.schemas.txt || true
129
+ echo "Added schemas (in new, not in baseline):"; comm -13 baseline.schemas.txt new.schemas.txt || true
130
+
131
+ - name: Compare normalized specs
132
+ id: diff
133
+ run: |
134
+ if [ "${{ steps.baseline.outputs.missing }}" = "true" ]; then
135
+ echo "changed=true" >> $GITHUB_OUTPUT
136
+ exit 0
137
+ fi
138
+ jq -S '
139
+ def sort_deep:
140
+ if type == "array" then
141
+ map(sort_deep) | sort_by(tostring)
142
+ elif type == "object" then
143
+ with_entries(.value |= sort_deep)
144
+ else . end;
145
+ (del(.info) | del(.servers)) | sort_deep
146
+ ' specs/openapi-baseline.json > baseline.norm.json
147
+ jq -S '
148
+ def sort_deep:
149
+ if type == "array" then
150
+ map(sort_deep) | sort_by(tostring)
151
+ elif type == "object" then
152
+ with_entries(.value |= sort_deep)
153
+ else . end;
154
+ (del(.info) | del(.servers)) | sort_deep
155
+ ' openapi-new.json > new.norm.json
156
+ if diff -q baseline.norm.json new.norm.json >/dev/null 2>&1; then
157
+ echo "changed=false" >> $GITHUB_OUTPUT
158
+ else
159
+ echo "changed=true" >> $GITHUB_OUTPUT
160
+ fi
161
+
162
+ - name: Upload normalized specs
163
+ if: always()
164
+ uses: actions/upload-artifact@v4
165
+ with:
166
+ name: normalized-specs
167
+ path: |
168
+ baseline.norm.json
169
+ new.norm.json
170
+ retention-days: 7
171
+
172
+ release-on-dispatch:
173
+ name: Trigger SDK release (minor)
174
+ needs: detect
175
+ if: needs.detect.outputs.changed == 'true'
176
+ uses: ./.github/workflows/release.yml
177
+ with:
178
+ version_type: minor
179
+ dry_run: ${{ github.event.client_payload.dry_run == true }}
180
+ spec_url: ${{ needs.detect.outputs.spec_url }}
181
+ secrets: inherit
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: amigo_sdk
3
- Version: 0.7.0
3
+ Version: 0.9.0
4
4
  Summary: Amigo AI Python SDK
5
5
  Author: Amigo AI
6
6
  License-File: LICENSE
@@ -46,34 +46,23 @@ amigo_sdk
46
46
 
47
47
  This SDK auto-generates its types from the latest [Amigo OpenAPI schema](https://api.amigo.ai/v1/openapi.json). As a result, only the latest published SDK version is guaranteed to match the current API. If you pin to an older version, it may not include the newest endpoints or fields.
48
48
 
49
- ## Quick Start
49
+ ## Quick Start (sync)
50
50
 
51
51
  ```python
52
- import asyncio
53
52
  from amigo_sdk import AmigoClient
54
53
  from amigo_sdk.generated.model import GetConversationsParametersQuery
55
54
 
56
- # Initialize the client
57
- client = AmigoClient(
55
+ # Initialize and use the client synchronously
56
+ with AmigoClient(
58
57
  api_key="your-api-key",
59
58
  api_key_id="your-api-key-id",
60
59
  user_id="user-id",
61
- org_id="your-organization-id",
62
- )
63
-
64
- # List recent conversations
65
- async def example():
66
- try:
67
- async with client:
68
- conversations = await client.conversation.get_conversations(
69
- GetConversationsParametersQuery(limit=10, sort_by=["-created_at"])
70
- )
71
- print("Conversations:", conversations)
72
- except Exception as error:
73
- print(error)
74
-
75
- # Run the example
76
- asyncio.run(example())
60
+ organization_id="your-organization-id",
61
+ ) as client:
62
+ conversations = client.conversation.get_conversations(
63
+ GetConversationsParametersQuery(limit=10, sort_by=["-created_at"])
64
+ )
65
+ print("Conversations:", conversations)
77
66
  ```
78
67
 
79
68
  ## Examples
@@ -84,13 +73,13 @@ For more SDK usage examples see checkout the [examples/](examples/README.md) fol
84
73
 
85
74
  The SDK requires the following configuration parameters:
86
75
 
87
- | Parameter | Type | Required | Description |
88
- | ------------ | ---- | -------- | -------------------------------------------------------------- |
89
- | `api_key` | str | ✅ | API key from Amigo dashboard |
90
- | `api_key_id` | str | ✅ | API key ID from Amigo dashboard |
91
- | `user_id` | str | ✅ | User ID on whose behalf the request is made |
92
- | `org_id` | str | ✅ | Your organization ID |
93
- | `base_url` | str | ❌ | Base URL of the Amigo API (defaults to `https://api.amigo.ai`) |
76
+ | Parameter | Type | Required | Description |
77
+ | ----------------- | ---- | -------- | -------------------------------------------------------------- |
78
+ | `api_key` | str | ✅ | API key from Amigo dashboard |
79
+ | `api_key_id` | str | ✅ | API key ID from Amigo dashboard |
80
+ | `user_id` | str | ✅ | User ID on whose behalf the request is made |
81
+ | `organization_id` | str | ✅ | Your organization ID |
82
+ | `base_url` | str | ❌ | Base URL of the Amigo API (defaults to `https://api.amigo.ai`) |
94
83
 
95
84
  ### Environment Variables
96
85
 
@@ -100,7 +89,7 @@ You can also configure the SDK using environment variables:
100
89
  export AMIGO_API_KEY="your-api-key"
101
90
  export AMIGO_API_KEY_ID="your-api-key-id"
102
91
  export AMIGO_USER_ID="user-id"
103
- export AMIGO_ORG_ID="your-organization-id"
92
+ export AMIGO_ORGANIZATION_ID="your-organization-id"
104
93
  export AMIGO_BASE_URL="https://api.amigo.ai" # optional
105
94
  ```
106
95
 
@@ -110,7 +99,8 @@ Then initialize the client without parameters:
110
99
  from amigo_sdk import AmigoClient
111
100
 
112
101
  # Automatically loads from environment variables
113
- client = AmigoClient()
102
+ with AmigoClient() as client:
103
+ ...
114
104
  ```
115
105
 
116
106
  ### Using .env Files
@@ -153,25 +143,23 @@ from amigo_sdk.errors import (
153
143
  AuthenticationError,
154
144
  NotFoundError,
155
145
  BadRequestError,
156
- ValidationError
146
+ ValidationError,
157
147
  )
158
148
 
159
- async def example_with_error_handling():
160
- client = AmigoClient()
161
-
162
- try:
163
- async with client:
164
- result = await client.organizations.get_organization("org-id")
165
- except AuthenticationError as error:
166
- print("Authentication failed:", error)
167
- except NotFoundError as error:
168
- print("Resource not found:", error)
169
- except BadRequestError as error:
170
- print("Bad request:", error)
171
- except ValidationError as error:
172
- print("Validation error:", error)
173
- except Exception as error:
174
- print("Unexpected error:", error)
149
+ try:
150
+ with AmigoClient() as client:
151
+ org = client.organization.get()
152
+ print("Organization:", org)
153
+ except AuthenticationError as error:
154
+ print("Authentication failed:", error)
155
+ except NotFoundError as error:
156
+ print("Resource not found:", error)
157
+ except BadRequestError as error:
158
+ print("Bad request:", error)
159
+ except ValidationError as error:
160
+ print("Validation error:", error)
161
+ except Exception as error:
162
+ print("Unexpected error:", error)
175
163
  ```
176
164
 
177
165
  ## Development
@@ -24,34 +24,23 @@ amigo_sdk
24
24
 
25
25
  This SDK auto-generates its types from the latest [Amigo OpenAPI schema](https://api.amigo.ai/v1/openapi.json). As a result, only the latest published SDK version is guaranteed to match the current API. If you pin to an older version, it may not include the newest endpoints or fields.
26
26
 
27
- ## Quick Start
27
+ ## Quick Start (sync)
28
28
 
29
29
  ```python
30
- import asyncio
31
30
  from amigo_sdk import AmigoClient
32
31
  from amigo_sdk.generated.model import GetConversationsParametersQuery
33
32
 
34
- # Initialize the client
35
- client = AmigoClient(
33
+ # Initialize and use the client synchronously
34
+ with AmigoClient(
36
35
  api_key="your-api-key",
37
36
  api_key_id="your-api-key-id",
38
37
  user_id="user-id",
39
- org_id="your-organization-id",
40
- )
41
-
42
- # List recent conversations
43
- async def example():
44
- try:
45
- async with client:
46
- conversations = await client.conversation.get_conversations(
47
- GetConversationsParametersQuery(limit=10, sort_by=["-created_at"])
48
- )
49
- print("Conversations:", conversations)
50
- except Exception as error:
51
- print(error)
52
-
53
- # Run the example
54
- asyncio.run(example())
38
+ organization_id="your-organization-id",
39
+ ) as client:
40
+ conversations = client.conversation.get_conversations(
41
+ GetConversationsParametersQuery(limit=10, sort_by=["-created_at"])
42
+ )
43
+ print("Conversations:", conversations)
55
44
  ```
56
45
 
57
46
  ## Examples
@@ -62,13 +51,13 @@ For more SDK usage examples see checkout the [examples/](examples/README.md) fol
62
51
 
63
52
  The SDK requires the following configuration parameters:
64
53
 
65
- | Parameter | Type | Required | Description |
66
- | ------------ | ---- | -------- | -------------------------------------------------------------- |
67
- | `api_key` | str | ✅ | API key from Amigo dashboard |
68
- | `api_key_id` | str | ✅ | API key ID from Amigo dashboard |
69
- | `user_id` | str | ✅ | User ID on whose behalf the request is made |
70
- | `org_id` | str | ✅ | Your organization ID |
71
- | `base_url` | str | ❌ | Base URL of the Amigo API (defaults to `https://api.amigo.ai`) |
54
+ | Parameter | Type | Required | Description |
55
+ | ----------------- | ---- | -------- | -------------------------------------------------------------- |
56
+ | `api_key` | str | ✅ | API key from Amigo dashboard |
57
+ | `api_key_id` | str | ✅ | API key ID from Amigo dashboard |
58
+ | `user_id` | str | ✅ | User ID on whose behalf the request is made |
59
+ | `organization_id` | str | ✅ | Your organization ID |
60
+ | `base_url` | str | ❌ | Base URL of the Amigo API (defaults to `https://api.amigo.ai`) |
72
61
 
73
62
  ### Environment Variables
74
63
 
@@ -78,7 +67,7 @@ You can also configure the SDK using environment variables:
78
67
  export AMIGO_API_KEY="your-api-key"
79
68
  export AMIGO_API_KEY_ID="your-api-key-id"
80
69
  export AMIGO_USER_ID="user-id"
81
- export AMIGO_ORG_ID="your-organization-id"
70
+ export AMIGO_ORGANIZATION_ID="your-organization-id"
82
71
  export AMIGO_BASE_URL="https://api.amigo.ai" # optional
83
72
  ```
84
73
 
@@ -88,7 +77,8 @@ Then initialize the client without parameters:
88
77
  from amigo_sdk import AmigoClient
89
78
 
90
79
  # Automatically loads from environment variables
91
- client = AmigoClient()
80
+ with AmigoClient() as client:
81
+ ...
92
82
  ```
93
83
 
94
84
  ### Using .env Files
@@ -131,25 +121,23 @@ from amigo_sdk.errors import (
131
121
  AuthenticationError,
132
122
  NotFoundError,
133
123
  BadRequestError,
134
- ValidationError
124
+ ValidationError,
135
125
  )
136
126
 
137
- async def example_with_error_handling():
138
- client = AmigoClient()
139
-
140
- try:
141
- async with client:
142
- result = await client.organizations.get_organization("org-id")
143
- except AuthenticationError as error:
144
- print("Authentication failed:", error)
145
- except NotFoundError as error:
146
- print("Resource not found:", error)
147
- except BadRequestError as error:
148
- print("Bad request:", error)
149
- except ValidationError as error:
150
- print("Validation error:", error)
151
- except Exception as error:
152
- print("Unexpected error:", error)
127
+ try:
128
+ with AmigoClient() as client:
129
+ org = client.organization.get()
130
+ print("Organization:", org)
131
+ except AuthenticationError as error:
132
+ print("Authentication failed:", error)
133
+ except NotFoundError as error:
134
+ print("Resource not found:", error)
135
+ except BadRequestError as error:
136
+ print("Bad request:", error)
137
+ except ValidationError as error:
138
+ print("Validation error:", error)
139
+ except Exception as error:
140
+ print("Unexpected error:", error)
153
141
  ```
154
142
 
155
143
  ## Development