amigo_sdk 0.8.0__tar.gz → 0.10.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 (52) hide show
  1. {amigo_sdk-0.8.0 → amigo_sdk-0.10.0}/.github/workflows/auto-release.yml +46 -12
  2. {amigo_sdk-0.8.0 → amigo_sdk-0.10.0}/.github/workflows/release.yml +12 -7
  3. {amigo_sdk-0.8.0 → amigo_sdk-0.10.0}/.gitignore +4 -1
  4. {amigo_sdk-0.8.0 → amigo_sdk-0.10.0}/PKG-INFO +35 -47
  5. {amigo_sdk-0.8.0 → amigo_sdk-0.10.0}/README.md +34 -46
  6. amigo_sdk-0.10.0/specs/openapi-baseline.json +1 -0
  7. amigo_sdk-0.10.0/src/amigo_sdk/__init__.py +8 -0
  8. amigo_sdk-0.10.0/src/amigo_sdk/_retry_utils.py +70 -0
  9. amigo_sdk-0.10.0/src/amigo_sdk/auth.py +48 -0
  10. {amigo_sdk-0.8.0 → amigo_sdk-0.10.0}/src/amigo_sdk/generated/model.py +15 -13
  11. amigo_sdk-0.10.0/src/amigo_sdk/http_client.py +379 -0
  12. {amigo_sdk-0.8.0 → amigo_sdk-0.10.0}/src/amigo_sdk/resources/conversation.py +156 -4
  13. {amigo_sdk-0.8.0 → amigo_sdk-0.10.0}/src/amigo_sdk/resources/organization.py +15 -3
  14. {amigo_sdk-0.8.0 → amigo_sdk-0.10.0}/src/amigo_sdk/resources/service.py +21 -5
  15. {amigo_sdk-0.8.0 → amigo_sdk-0.10.0}/src/amigo_sdk/resources/user.py +43 -3
  16. {amigo_sdk-0.8.0 → amigo_sdk-0.10.0}/src/amigo_sdk/sdk_client.py +100 -18
  17. {amigo_sdk-0.8.0 → amigo_sdk-0.10.0}/tests/integration/test_conversation_integration.py +153 -10
  18. {amigo_sdk-0.8.0 → amigo_sdk-0.10.0}/tests/integration/test_organization_integration.py +83 -31
  19. amigo_sdk-0.10.0/tests/integration/test_user_integration.py +181 -0
  20. {amigo_sdk-0.8.0 → amigo_sdk-0.10.0}/tests/resources/helpers.py +154 -4
  21. amigo_sdk-0.10.0/tests/resources/test_conversation.py +882 -0
  22. amigo_sdk-0.10.0/tests/resources/test_organization.py +95 -0
  23. {amigo_sdk-0.8.0 → amigo_sdk-0.10.0}/tests/resources/test_service.py +37 -5
  24. {amigo_sdk-0.8.0 → amigo_sdk-0.10.0}/tests/resources/test_user.py +95 -5
  25. {amigo_sdk-0.8.0 → amigo_sdk-0.10.0}/tests/test_auth.py +70 -5
  26. amigo_sdk-0.10.0/tests/test_http_client.py +741 -0
  27. amigo_sdk-0.10.0/tests/test_retry_utils.py +86 -0
  28. {amigo_sdk-0.8.0 → amigo_sdk-0.10.0}/tests/test_sdk_client.py +59 -8
  29. amigo_sdk-0.8.0/openapi-new.json +0 -1
  30. amigo_sdk-0.8.0/specs/openapi-baseline.json +0 -1
  31. amigo_sdk-0.8.0/src/amigo_sdk/__init__.py +0 -1
  32. amigo_sdk-0.8.0/src/amigo_sdk/auth.py +0 -30
  33. amigo_sdk-0.8.0/src/amigo_sdk/http_client.py +0 -228
  34. amigo_sdk-0.8.0/tests/integration/test_user_integration.py +0 -97
  35. amigo_sdk-0.8.0/tests/resources/test_conversation.py +0 -463
  36. amigo_sdk-0.8.0/tests/resources/test_organization.py +0 -60
  37. amigo_sdk-0.8.0/tests/test_http_client.py +0 -551
  38. {amigo_sdk-0.8.0 → amigo_sdk-0.10.0}/.github/workflows/test.yml +0 -0
  39. {amigo_sdk-0.8.0 → amigo_sdk-0.10.0}/CONTRIBUTING.md +0 -0
  40. {amigo_sdk-0.8.0 → amigo_sdk-0.10.0}/LICENSE +0 -0
  41. {amigo_sdk-0.8.0 → amigo_sdk-0.10.0}/pyproject.toml +0 -0
  42. {amigo_sdk-0.8.0 → amigo_sdk-0.10.0}/scripts/__init__.py +0 -0
  43. {amigo_sdk-0.8.0 → amigo_sdk-0.10.0}/scripts/aliases.json +0 -0
  44. {amigo_sdk-0.8.0 → amigo_sdk-0.10.0}/scripts/check.py +0 -0
  45. {amigo_sdk-0.8.0 → amigo_sdk-0.10.0}/scripts/gen_models.py +0 -0
  46. {amigo_sdk-0.8.0 → amigo_sdk-0.10.0}/src/amigo_sdk/config.py +0 -0
  47. {amigo_sdk-0.8.0 → amigo_sdk-0.10.0}/src/amigo_sdk/errors.py +0 -0
  48. {amigo_sdk-0.8.0 → amigo_sdk-0.10.0}/tests/__init__.py +0 -0
  49. {amigo_sdk-0.8.0 → amigo_sdk-0.10.0}/tests/conftest.py +0 -0
  50. {amigo_sdk-0.8.0 → amigo_sdk-0.10.0}/tests/resources/__init__.py +0 -0
  51. {amigo_sdk-0.8.0 → amigo_sdk-0.10.0}/tests/test_config.py +0 -0
  52. {amigo_sdk-0.8.0 → amigo_sdk-0.10.0}/tests/test_errors.py +0 -0
@@ -30,7 +30,9 @@ jobs:
30
30
  echo "spec_url=$SPEC_URL" >> $GITHUB_OUTPUT
31
31
 
32
32
  - name: Fetch current production spec
33
- run: curl -fSL -o openapi-new.json "${{ steps.spec.outputs.spec_url }}"
33
+ run: |
34
+ mkdir -p specs
35
+ curl -fSL -o specs/openapi-new.json "${{ steps.spec.outputs.spec_url }}"
34
36
 
35
37
  - name: Check baseline presence
36
38
  id: baseline
@@ -46,7 +48,7 @@ jobs:
46
48
  run: |
47
49
  mkdir -p specs
48
50
  if [ ! -f specs/openapi-baseline.json ]; then
49
- cp openapi-new.json specs/openapi-baseline.json
51
+ cp specs/openapi-new.json specs/openapi-baseline.json
50
52
  fi
51
53
 
52
54
  - name: Diagnostics (spec and baseline)
@@ -54,8 +56,24 @@ jobs:
54
56
  echo "Resolved spec_url: ${{ steps.spec.outputs.spec_url }}"
55
57
  echo "Baseline missing: ${{ steps.baseline.outputs.missing }}"
56
58
  echo "jq version: $(jq --version)"
57
- jq -S 'del(.info.version) | del(.servers)' specs/openapi-baseline.json > baseline.norm.json || true
58
- jq -S 'del(.info.version) | del(.servers)' openapi-new.json > new.norm.json
59
+ jq -S '
60
+ def sort_deep:
61
+ if type == "array" then
62
+ map(sort_deep) | sort_by(tostring)
63
+ elif type == "object" then
64
+ with_entries(.value |= sort_deep)
65
+ else . end;
66
+ (del(.info) | del(.servers)) | sort_deep
67
+ ' specs/openapi-baseline.json > baseline.norm.json || true
68
+ jq -S '
69
+ def sort_deep:
70
+ if type == "array" then
71
+ map(sort_deep) | sort_by(tostring)
72
+ elif type == "object" then
73
+ with_entries(.value |= sort_deep)
74
+ else . end;
75
+ (del(.info) | del(.servers)) | sort_deep
76
+ ' specs/openapi-new.json > new.norm.json
59
77
  if [ -f baseline.norm.json ]; then
60
78
  echo "BASELINE_NORM_SHA=$(sha256sum baseline.norm.json | awk '{print $1}')"
61
79
  else
@@ -83,10 +101,10 @@ jobs:
83
101
  BASELINE_PATHS_COUNT=0
84
102
  BASELINE_SCHEMAS_COUNT=0
85
103
  fi
86
- NEW_PATHS_SHA=$(jq -cS '(.paths // {})' openapi-new.json | sha256sum | awk '{print $1}')
87
- NEW_SCHEMAS_SHA=$(jq -cS '(.components.schemas // {})' openapi-new.json | sha256sum | awk '{print $1}')
88
- NEW_PATHS_COUNT=$(jq -r '(.paths // {}) | keys | length' openapi-new.json)
89
- NEW_SCHEMAS_COUNT=$(jq -r '(.components.schemas // {}) | keys | length' openapi-new.json)
104
+ NEW_PATHS_SHA=$(jq -cS '(.paths // {})' specs/openapi-new.json | sha256sum | awk '{print $1}')
105
+ NEW_SCHEMAS_SHA=$(jq -cS '(.components.schemas // {})' specs/openapi-new.json | sha256sum | awk '{print $1}')
106
+ NEW_PATHS_COUNT=$(jq -r '(.paths // {}) | keys | length' specs/openapi-new.json)
107
+ NEW_SCHEMAS_COUNT=$(jq -r '(.components.schemas // {}) | keys | length' specs/openapi-new.json)
90
108
  echo "BASELINE paths: count=$BASELINE_PATHS_COUNT sha=$BASELINE_PATHS_SHA"
91
109
  echo "NEW paths: count=$NEW_PATHS_COUNT sha=$NEW_PATHS_SHA"
92
110
  echo "BASELINE schemas: count=$BASELINE_SCHEMAS_COUNT sha=$BASELINE_SCHEMAS_SHA"
@@ -98,7 +116,7 @@ jobs:
98
116
  else
99
117
  : > baseline.paths.txt
100
118
  fi
101
- jq -r '(.paths // {}) | keys | sort[]' openapi-new.json > new.paths.txt
119
+ jq -r '(.paths // {}) | keys | sort[]' specs/openapi-new.json > new.paths.txt
102
120
  echo "Removed paths (in baseline, not in new):"; comm -23 baseline.paths.txt new.paths.txt || true
103
121
  echo "Added paths (in new, not in baseline):"; comm -13 baseline.paths.txt new.paths.txt || true
104
122
 
@@ -108,7 +126,7 @@ jobs:
108
126
  else
109
127
  : > baseline.schemas.txt
110
128
  fi
111
- jq -r '(.components.schemas // {}) | keys | sort[]' openapi-new.json > new.schemas.txt
129
+ jq -r '(.components.schemas // {}) | keys | sort[]' specs/openapi-new.json > new.schemas.txt
112
130
  echo "Removed schemas (in baseline, not in new):"; comm -23 baseline.schemas.txt new.schemas.txt || true
113
131
  echo "Added schemas (in new, not in baseline):"; comm -13 baseline.schemas.txt new.schemas.txt || true
114
132
 
@@ -119,8 +137,24 @@ jobs:
119
137
  echo "changed=true" >> $GITHUB_OUTPUT
120
138
  exit 0
121
139
  fi
122
- jq -S 'del(.info.version) | del(.servers)' specs/openapi-baseline.json > baseline.norm.json
123
- jq -S 'del(.info.version) | del(.servers)' openapi-new.json > new.norm.json
140
+ jq -S '
141
+ def sort_deep:
142
+ if type == "array" then
143
+ map(sort_deep) | sort_by(tostring)
144
+ elif type == "object" then
145
+ with_entries(.value |= sort_deep)
146
+ else . end;
147
+ (del(.info) | del(.servers)) | sort_deep
148
+ ' specs/openapi-baseline.json > baseline.norm.json
149
+ jq -S '
150
+ def sort_deep:
151
+ if type == "array" then
152
+ map(sort_deep) | sort_by(tostring)
153
+ elif type == "object" then
154
+ with_entries(.value |= sort_deep)
155
+ else . end;
156
+ (del(.info) | del(.servers)) | sort_deep
157
+ ' specs/openapi-new.json > new.norm.json
124
158
  if diff -q baseline.norm.json new.norm.json >/dev/null 2>&1; then
125
159
  echo "changed=false" >> $GITHUB_OUTPUT
126
160
  else
@@ -51,13 +51,20 @@ jobs:
51
51
  needs: test
52
52
 
53
53
  steps:
54
+ - name: Create GitHub App token (release-bot)
55
+ id: app-token
56
+ uses: actions/create-github-app-token@v2
57
+ with:
58
+ app-id: ${{ secrets.RELEASE_BOT_APP_ID }}
59
+ private-key: ${{ secrets.RELEASE_BOT_PRIVATE_KEY }}
60
+
54
61
  - name: Checkout code
55
62
  uses: actions/checkout@v4
56
63
  with:
57
64
  # Fetch full history for version tagging
58
65
  fetch-depth: 0
59
66
  # Use a token that can push tags and create releases
60
- token: ${{ secrets.GITHUB_TOKEN }}
67
+ token: ${{ steps.app-token.outputs.token }}
61
68
 
62
69
  - name: Ensure jq
63
70
  run: sudo apt-get update && sudo apt-get install -y jq
@@ -69,13 +76,11 @@ jobs:
69
76
  if [ -z "$SPEC_URL" ]; then
70
77
  SPEC_URL="https://api.amigo.ai/v1/openapi.json"
71
78
  fi
72
- curl -fSL -o openapi-new.json "$SPEC_URL"
73
79
  mkdir -p specs
74
- cp openapi-new.json specs/openapi-baseline.json
80
+ curl -fSL -o specs/openapi-new.json "$SPEC_URL"
81
+ cp specs/openapi-new.json specs/openapi-baseline.json
75
82
 
76
- # Optional: if your generator can take a spec path
77
- - name: Set spec path for generator
78
- run: echo "OPENAPI_SPEC_PATH=$GITHUB_WORKSPACE/openapi-new.json" >> $GITHUB_ENV
83
+ # Generator always fetches remote; no local spec path needed
79
84
 
80
85
  - name: Setup Python
81
86
  uses: actions/setup-python@v5
@@ -152,7 +157,7 @@ jobs:
152
157
  if: ${{ !inputs.dry_run }}
153
158
  uses: actions/create-release@v1
154
159
  env:
155
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
160
+ GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
156
161
  with:
157
162
  tag_name: "v${{ steps.new_version.outputs.version }}"
158
163
  release_name: "Release v${{ steps.new_version.outputs.version }}"
@@ -12,4 +12,7 @@ dist/
12
12
  # Coverage files
13
13
  htmlcov/
14
14
  coverage.xml
15
- .coverage
15
+ .coverage
16
+
17
+ # CI/Temp OpenAPI spec (fetched during workflows)
18
+ specs/openapi-new.json
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: amigo_sdk
3
- Version: 0.8.0
3
+ Version: 0.10.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