adsk-platform-authentication 0.2.9__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.
- adsk_platform_authentication-0.2.9/PKG-INFO +229 -0
- adsk_platform_authentication-0.2.9/README.md +197 -0
- adsk_platform_authentication-0.2.9/pyproject.toml +56 -0
- adsk_platform_authentication-0.2.9/setup.cfg +4 -0
- adsk_platform_authentication-0.2.9/src/adsk_platform_authentication.egg-info/PKG-INFO +229 -0
- adsk_platform_authentication-0.2.9/src/adsk_platform_authentication.egg-info/SOURCES.txt +41 -0
- adsk_platform_authentication-0.2.9/src/adsk_platform_authentication.egg-info/dependency_links.txt +1 -0
- adsk_platform_authentication-0.2.9/src/adsk_platform_authentication.egg-info/requires.txt +8 -0
- adsk_platform_authentication-0.2.9/src/adsk_platform_authentication.egg-info/top_level.txt +1 -0
- adsk_platform_authentication-0.2.9/src/autodesk_authentication/__init__.py +21 -0
- adsk_platform_authentication-0.2.9/src/autodesk_authentication/authentication_client.py +54 -0
- adsk_platform_authentication-0.2.9/src/autodesk_authentication/authentication_client_helper.py +360 -0
- adsk_platform_authentication-0.2.9/src/autodesk_authentication/generated_code/authentication/authentication_request_builder.py +33 -0
- adsk_platform_authentication-0.2.9/src/autodesk_authentication/generated_code/authentication/v2/authorize/authorize_request_builder.py +109 -0
- adsk_platform_authentication-0.2.9/src/autodesk_authentication/generated_code/authentication/v2/introspect/introspect_post_request_body.py +47 -0
- adsk_platform_authentication-0.2.9/src/autodesk_authentication/generated_code/authentication/v2/introspect/introspect_request_builder.py +89 -0
- adsk_platform_authentication-0.2.9/src/autodesk_authentication/generated_code/authentication/v2/introspect/introspecttoken400_error.py +54 -0
- adsk_platform_authentication-0.2.9/src/autodesk_authentication/generated_code/authentication/v2/keys/keys_get_response.py +50 -0
- adsk_platform_authentication-0.2.9/src/autodesk_authentication/generated_code/authentication/v2/keys/keys_request_builder.py +75 -0
- adsk_platform_authentication-0.2.9/src/autodesk_authentication/generated_code/authentication/v2/logout/logout_request_builder.py +78 -0
- adsk_platform_authentication-0.2.9/src/autodesk_authentication/generated_code/authentication/v2/revoke/revoke_post_request_body.py +51 -0
- adsk_platform_authentication-0.2.9/src/autodesk_authentication/generated_code/authentication/v2/revoke/revoke_post_response.py +38 -0
- adsk_platform_authentication-0.2.9/src/autodesk_authentication/generated_code/authentication/v2/revoke/revoke_request_builder.py +89 -0
- adsk_platform_authentication-0.2.9/src/autodesk_authentication/generated_code/authentication/v2/token/auth_token400_error.py +45 -0
- adsk_platform_authentication-0.2.9/src/autodesk_authentication/generated_code/authentication/v2/token/token_post_request_body.py +78 -0
- adsk_platform_authentication-0.2.9/src/autodesk_authentication/generated_code/authentication/v2/token/token_request_builder.py +93 -0
- adsk_platform_authentication-0.2.9/src/autodesk_authentication/generated_code/authentication/v2/v2_request_builder.py +83 -0
- adsk_platform_authentication-0.2.9/src/autodesk_authentication/generated_code/base_authentication_client.py +73 -0
- adsk_platform_authentication-0.2.9/src/autodesk_authentication/generated_code/kiota-lock.json +34 -0
- adsk_platform_authentication-0.2.9/src/autodesk_authentication/generated_code/models/auth_token.py +55 -0
- adsk_platform_authentication-0.2.9/src/autodesk_authentication/generated_code/models/error.py +62 -0
- adsk_platform_authentication-0.2.9/src/autodesk_authentication/generated_code/models/granttype.py +8 -0
- adsk_platform_authentication-0.2.9/src/autodesk_authentication/generated_code/models/introspecttoken.py +62 -0
- adsk_platform_authentication-0.2.9/src/autodesk_authentication/generated_code/models/jwks.py +59 -0
- adsk_platform_authentication-0.2.9/src/autodesk_authentication/generated_code/models/oidc_spec.py +94 -0
- adsk_platform_authentication-0.2.9/src/autodesk_authentication/generated_code/models/user_info.py +83 -0
- adsk_platform_authentication-0.2.9/src/autodesk_authentication/generated_code/userinfo/userinfo_request_builder.py +75 -0
- adsk_platform_authentication-0.2.9/src/autodesk_authentication/generated_code/well_known/openid_configuration/openid_configuration_request_builder.py +75 -0
- adsk_platform_authentication-0.2.9/src/autodesk_authentication/generated_code/well_known/well_known_request_builder.py +33 -0
- adsk_platform_authentication-0.2.9/src/autodesk_authentication/models/__init__.py +12 -0
- adsk_platform_authentication-0.2.9/src/autodesk_authentication/models/auth_token_extended.py +53 -0
- adsk_platform_authentication-0.2.9/src/autodesk_authentication/models/authentication_scope.py +25 -0
- adsk_platform_authentication-0.2.9/src/autodesk_authentication/models/token_store.py +34 -0
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: adsk-platform-authentication
|
|
3
|
+
Version: 0.2.9
|
|
4
|
+
Summary: Autodesk Platform: Authentication SDK for Python
|
|
5
|
+
Author: duszykf
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Documentation, https://aps.autodesk.com/en/docs/oauth/v2/overview/
|
|
8
|
+
Project-URL: Repository, https://github.com/Autodesk/APS-SDK-Kiota
|
|
9
|
+
Project-URL: Issues, https://github.com/Autodesk/APS-SDK-Kiota/issues
|
|
10
|
+
Keywords: autodesk,authentication,aps,oauth,kiota,sdk
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Operating System :: OS Independent
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
20
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
21
|
+
Classifier: Typing :: Typed
|
|
22
|
+
Requires-Python: >=3.10
|
|
23
|
+
Description-Content-Type: text/markdown
|
|
24
|
+
Requires-Dist: adsk-platform-httpclient<1.0.0,>=0.1.0
|
|
25
|
+
Requires-Dist: microsoft-kiota-abstractions<2.0.0,>=1.9.0
|
|
26
|
+
Requires-Dist: microsoft-kiota-http<2.0.0,>=1.9.0
|
|
27
|
+
Requires-Dist: microsoft-kiota-serialization-json<2.0.0,>=1.9.0
|
|
28
|
+
Requires-Dist: microsoft-kiota-serialization-text<2.0.0,>=1.9.0
|
|
29
|
+
Requires-Dist: microsoft-kiota-serialization-form<2.0.0,>=1.9.0
|
|
30
|
+
Requires-Dist: microsoft-kiota-serialization-multipart<2.0.0,>=1.9.0
|
|
31
|
+
Requires-Dist: httpx<1.0.0,>=0.27.0
|
|
32
|
+
|
|
33
|
+
# autodesk-authentication - Autodesk Authentication SDK for Python
|
|
34
|
+
|
|
35
|
+
A Python SDK providing a [Fluent API](https://dzone.com/articles/java-fluent-api) for the [Autodesk Authentication](https://aps.autodesk.com/en/docs/oauth/v2/overview/) APIs, generated from the official OpenAPI specifications using [Microsoft Kiota](https://learn.microsoft.com/en-us/openapi/kiota/overview).
|
|
36
|
+
|
|
37
|
+
## Installation
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
pip install adsk-platform-authentication
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Quick Start
|
|
44
|
+
|
|
45
|
+
```python
|
|
46
|
+
from autodesk_authentication import AuthenticationClient
|
|
47
|
+
|
|
48
|
+
# Initialize the Authentication client
|
|
49
|
+
auth_client = AuthenticationClient()
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### 2-Legged Token (Client Credentials)
|
|
53
|
+
|
|
54
|
+
```python
|
|
55
|
+
import os
|
|
56
|
+
from autodesk_authentication import AuthenticationClient
|
|
57
|
+
|
|
58
|
+
client_id = os.environ["APS_CLIENT_ID"]
|
|
59
|
+
client_secret = os.environ["APS_CLIENT_SECRET"]
|
|
60
|
+
|
|
61
|
+
auth_client = AuthenticationClient()
|
|
62
|
+
|
|
63
|
+
token = await auth_client.helper.get_two_legged_token(
|
|
64
|
+
client_id,
|
|
65
|
+
client_secret,
|
|
66
|
+
scopes=["data:read", "data:write", "account:read"],
|
|
67
|
+
)
|
|
68
|
+
|
|
69
|
+
print(f"Access Token: {token.access_token}")
|
|
70
|
+
print(f"Expires At: {token.expires_at}")
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### Auto-Refreshing Token
|
|
74
|
+
|
|
75
|
+
```python
|
|
76
|
+
from autodesk_authentication import AuthenticationClient, InMemoryTokenStore
|
|
77
|
+
|
|
78
|
+
auth_client = AuthenticationClient()
|
|
79
|
+
token_store = InMemoryTokenStore()
|
|
80
|
+
|
|
81
|
+
get_token = auth_client.helper.create_two_legged_auto_refresh_token(
|
|
82
|
+
client_id,
|
|
83
|
+
client_secret,
|
|
84
|
+
scopes=["data:read", "data:write"],
|
|
85
|
+
token_store=token_store,
|
|
86
|
+
)
|
|
87
|
+
|
|
88
|
+
# This callable auto-refreshes when the token is about to expire
|
|
89
|
+
access_token = await get_token()
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### Using Scope Enum
|
|
93
|
+
|
|
94
|
+
```python
|
|
95
|
+
from autodesk_authentication import AuthenticationClient, AuthenticationScope
|
|
96
|
+
|
|
97
|
+
auth_client = AuthenticationClient()
|
|
98
|
+
|
|
99
|
+
token = await auth_client.helper.get_two_legged_token(
|
|
100
|
+
client_id,
|
|
101
|
+
client_secret,
|
|
102
|
+
scopes=[AuthenticationScope.DATA_READ, AuthenticationScope.ACCOUNT_READ],
|
|
103
|
+
)
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### 3-Legged Authentication (Authorization Code)
|
|
107
|
+
|
|
108
|
+
```python
|
|
109
|
+
from autodesk_authentication import AuthenticationClient, AuthenticationClientHelper, AuthenticationScope
|
|
110
|
+
|
|
111
|
+
# Step 1: Generate the login URL
|
|
112
|
+
login_url = AuthenticationClientHelper.create_authentication_url(
|
|
113
|
+
client_id=client_id,
|
|
114
|
+
redirect_uri="http://localhost:3000/callback",
|
|
115
|
+
scope=[AuthenticationScope.DATA_READ, AuthenticationScope.VIEWABLES_READ],
|
|
116
|
+
)
|
|
117
|
+
print(f"Open this URL in a browser: {login_url}")
|
|
118
|
+
|
|
119
|
+
# Step 2: Extract the code from the callback URL
|
|
120
|
+
code = AuthenticationClientHelper.extract_code_from_url(callback_url)
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### 3-Legged with PKCE
|
|
124
|
+
|
|
125
|
+
```python
|
|
126
|
+
from autodesk_authentication import AuthenticationClientHelper, AuthenticationScope
|
|
127
|
+
|
|
128
|
+
# Generate PKCE challenge
|
|
129
|
+
code_verifier, code_challenge = AuthenticationClientHelper.create_pkce_code_challenge()
|
|
130
|
+
|
|
131
|
+
# Build the PKCE login URL
|
|
132
|
+
login_url = AuthenticationClientHelper.create_pkce_authentication_url(
|
|
133
|
+
client_id=client_id,
|
|
134
|
+
redirect_uri="http://localhost:3000/callback",
|
|
135
|
+
scope=[AuthenticationScope.DATA_READ],
|
|
136
|
+
code_challenge=code_challenge,
|
|
137
|
+
)
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
### Refresh a 3-Legged Token
|
|
141
|
+
|
|
142
|
+
```python
|
|
143
|
+
auth_client = AuthenticationClient()
|
|
144
|
+
|
|
145
|
+
refreshed = await auth_client.helper.refresh_three_legged_token(
|
|
146
|
+
client_id=client_id,
|
|
147
|
+
client_secret=client_secret,
|
|
148
|
+
refresh_token="REFRESH_TOKEN_FROM_PREVIOUS_AUTH",
|
|
149
|
+
)
|
|
150
|
+
print(f"New access token: {refreshed.access_token}")
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
### Get User Info
|
|
154
|
+
|
|
155
|
+
```python
|
|
156
|
+
auth_client = AuthenticationClient()
|
|
157
|
+
|
|
158
|
+
user_info = await auth_client.helper.get_user_info(three_legged_token="YOUR_3L_TOKEN")
|
|
159
|
+
print(f"Name: {user_info.name}, Email: {user_info.email}")
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
### Using the `.api` Property
|
|
163
|
+
|
|
164
|
+
The full generated API surface is accessible via `auth_client.api`:
|
|
165
|
+
|
|
166
|
+
```python
|
|
167
|
+
# Direct API call (equivalent to what .helper methods do internally)
|
|
168
|
+
from autodesk_authentication.generated_code.authentication.v2.token.token_post_request_body import (
|
|
169
|
+
TokenPostRequestBody,
|
|
170
|
+
)
|
|
171
|
+
from autodesk_authentication.generated_code.models.granttype import Granttype
|
|
172
|
+
|
|
173
|
+
body = TokenPostRequestBody()
|
|
174
|
+
body.grant_type = Granttype.Client_credentials
|
|
175
|
+
body.scope = "data:read"
|
|
176
|
+
|
|
177
|
+
result = await auth_client.api.authentication.v2.token.post(
|
|
178
|
+
body,
|
|
179
|
+
request_configuration=lambda r: r.headers.add("Authorization", auth_string),
|
|
180
|
+
)
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
## Custom HTTP Client
|
|
184
|
+
|
|
185
|
+
You can provide your own `httpx.AsyncClient` instance:
|
|
186
|
+
|
|
187
|
+
```python
|
|
188
|
+
import httpx
|
|
189
|
+
|
|
190
|
+
http_client = httpx.AsyncClient(timeout=60.0)
|
|
191
|
+
auth_client = AuthenticationClient(http_client=http_client)
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
## Error Handling
|
|
195
|
+
|
|
196
|
+
```python
|
|
197
|
+
from kiota_abstractions.api_error import APIError
|
|
198
|
+
|
|
199
|
+
try:
|
|
200
|
+
token = await auth_client.helper.get_two_legged_token(client_id, client_secret, scopes)
|
|
201
|
+
except APIError as e:
|
|
202
|
+
print(f"Request failed: {e.message}")
|
|
203
|
+
print(f"Status code: {e.response_status_code}")
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
## Requirements
|
|
207
|
+
|
|
208
|
+
- Python 3.10 or later
|
|
209
|
+
- Valid Autodesk Platform Services (APS) application credentials
|
|
210
|
+
|
|
211
|
+
### Dependencies
|
|
212
|
+
|
|
213
|
+
- `microsoft-kiota-abstractions`
|
|
214
|
+
- `microsoft-kiota-http`
|
|
215
|
+
- `microsoft-kiota-serialization-json`
|
|
216
|
+
- `microsoft-kiota-serialization-text`
|
|
217
|
+
- `microsoft-kiota-serialization-form`
|
|
218
|
+
- `microsoft-kiota-serialization-multipart`
|
|
219
|
+
- `httpx`
|
|
220
|
+
|
|
221
|
+
## Documentation
|
|
222
|
+
|
|
223
|
+
- [Authentication API Documentation](https://aps.autodesk.com/en/docs/oauth/v2/overview/)
|
|
224
|
+
- [Autodesk Platform Services](https://aps.autodesk.com/)
|
|
225
|
+
- [Microsoft Kiota Documentation](https://learn.microsoft.com/en-us/openapi/kiota/overview)
|
|
226
|
+
|
|
227
|
+
## License
|
|
228
|
+
|
|
229
|
+
This project is licensed under the MIT License.
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
# autodesk-authentication - Autodesk Authentication SDK for Python
|
|
2
|
+
|
|
3
|
+
A Python SDK providing a [Fluent API](https://dzone.com/articles/java-fluent-api) for the [Autodesk Authentication](https://aps.autodesk.com/en/docs/oauth/v2/overview/) APIs, generated from the official OpenAPI specifications using [Microsoft Kiota](https://learn.microsoft.com/en-us/openapi/kiota/overview).
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pip install adsk-platform-authentication
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Quick Start
|
|
12
|
+
|
|
13
|
+
```python
|
|
14
|
+
from autodesk_authentication import AuthenticationClient
|
|
15
|
+
|
|
16
|
+
# Initialize the Authentication client
|
|
17
|
+
auth_client = AuthenticationClient()
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
### 2-Legged Token (Client Credentials)
|
|
21
|
+
|
|
22
|
+
```python
|
|
23
|
+
import os
|
|
24
|
+
from autodesk_authentication import AuthenticationClient
|
|
25
|
+
|
|
26
|
+
client_id = os.environ["APS_CLIENT_ID"]
|
|
27
|
+
client_secret = os.environ["APS_CLIENT_SECRET"]
|
|
28
|
+
|
|
29
|
+
auth_client = AuthenticationClient()
|
|
30
|
+
|
|
31
|
+
token = await auth_client.helper.get_two_legged_token(
|
|
32
|
+
client_id,
|
|
33
|
+
client_secret,
|
|
34
|
+
scopes=["data:read", "data:write", "account:read"],
|
|
35
|
+
)
|
|
36
|
+
|
|
37
|
+
print(f"Access Token: {token.access_token}")
|
|
38
|
+
print(f"Expires At: {token.expires_at}")
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### Auto-Refreshing Token
|
|
42
|
+
|
|
43
|
+
```python
|
|
44
|
+
from autodesk_authentication import AuthenticationClient, InMemoryTokenStore
|
|
45
|
+
|
|
46
|
+
auth_client = AuthenticationClient()
|
|
47
|
+
token_store = InMemoryTokenStore()
|
|
48
|
+
|
|
49
|
+
get_token = auth_client.helper.create_two_legged_auto_refresh_token(
|
|
50
|
+
client_id,
|
|
51
|
+
client_secret,
|
|
52
|
+
scopes=["data:read", "data:write"],
|
|
53
|
+
token_store=token_store,
|
|
54
|
+
)
|
|
55
|
+
|
|
56
|
+
# This callable auto-refreshes when the token is about to expire
|
|
57
|
+
access_token = await get_token()
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### Using Scope Enum
|
|
61
|
+
|
|
62
|
+
```python
|
|
63
|
+
from autodesk_authentication import AuthenticationClient, AuthenticationScope
|
|
64
|
+
|
|
65
|
+
auth_client = AuthenticationClient()
|
|
66
|
+
|
|
67
|
+
token = await auth_client.helper.get_two_legged_token(
|
|
68
|
+
client_id,
|
|
69
|
+
client_secret,
|
|
70
|
+
scopes=[AuthenticationScope.DATA_READ, AuthenticationScope.ACCOUNT_READ],
|
|
71
|
+
)
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### 3-Legged Authentication (Authorization Code)
|
|
75
|
+
|
|
76
|
+
```python
|
|
77
|
+
from autodesk_authentication import AuthenticationClient, AuthenticationClientHelper, AuthenticationScope
|
|
78
|
+
|
|
79
|
+
# Step 1: Generate the login URL
|
|
80
|
+
login_url = AuthenticationClientHelper.create_authentication_url(
|
|
81
|
+
client_id=client_id,
|
|
82
|
+
redirect_uri="http://localhost:3000/callback",
|
|
83
|
+
scope=[AuthenticationScope.DATA_READ, AuthenticationScope.VIEWABLES_READ],
|
|
84
|
+
)
|
|
85
|
+
print(f"Open this URL in a browser: {login_url}")
|
|
86
|
+
|
|
87
|
+
# Step 2: Extract the code from the callback URL
|
|
88
|
+
code = AuthenticationClientHelper.extract_code_from_url(callback_url)
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### 3-Legged with PKCE
|
|
92
|
+
|
|
93
|
+
```python
|
|
94
|
+
from autodesk_authentication import AuthenticationClientHelper, AuthenticationScope
|
|
95
|
+
|
|
96
|
+
# Generate PKCE challenge
|
|
97
|
+
code_verifier, code_challenge = AuthenticationClientHelper.create_pkce_code_challenge()
|
|
98
|
+
|
|
99
|
+
# Build the PKCE login URL
|
|
100
|
+
login_url = AuthenticationClientHelper.create_pkce_authentication_url(
|
|
101
|
+
client_id=client_id,
|
|
102
|
+
redirect_uri="http://localhost:3000/callback",
|
|
103
|
+
scope=[AuthenticationScope.DATA_READ],
|
|
104
|
+
code_challenge=code_challenge,
|
|
105
|
+
)
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### Refresh a 3-Legged Token
|
|
109
|
+
|
|
110
|
+
```python
|
|
111
|
+
auth_client = AuthenticationClient()
|
|
112
|
+
|
|
113
|
+
refreshed = await auth_client.helper.refresh_three_legged_token(
|
|
114
|
+
client_id=client_id,
|
|
115
|
+
client_secret=client_secret,
|
|
116
|
+
refresh_token="REFRESH_TOKEN_FROM_PREVIOUS_AUTH",
|
|
117
|
+
)
|
|
118
|
+
print(f"New access token: {refreshed.access_token}")
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### Get User Info
|
|
122
|
+
|
|
123
|
+
```python
|
|
124
|
+
auth_client = AuthenticationClient()
|
|
125
|
+
|
|
126
|
+
user_info = await auth_client.helper.get_user_info(three_legged_token="YOUR_3L_TOKEN")
|
|
127
|
+
print(f"Name: {user_info.name}, Email: {user_info.email}")
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
### Using the `.api` Property
|
|
131
|
+
|
|
132
|
+
The full generated API surface is accessible via `auth_client.api`:
|
|
133
|
+
|
|
134
|
+
```python
|
|
135
|
+
# Direct API call (equivalent to what .helper methods do internally)
|
|
136
|
+
from autodesk_authentication.generated_code.authentication.v2.token.token_post_request_body import (
|
|
137
|
+
TokenPostRequestBody,
|
|
138
|
+
)
|
|
139
|
+
from autodesk_authentication.generated_code.models.granttype import Granttype
|
|
140
|
+
|
|
141
|
+
body = TokenPostRequestBody()
|
|
142
|
+
body.grant_type = Granttype.Client_credentials
|
|
143
|
+
body.scope = "data:read"
|
|
144
|
+
|
|
145
|
+
result = await auth_client.api.authentication.v2.token.post(
|
|
146
|
+
body,
|
|
147
|
+
request_configuration=lambda r: r.headers.add("Authorization", auth_string),
|
|
148
|
+
)
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
## Custom HTTP Client
|
|
152
|
+
|
|
153
|
+
You can provide your own `httpx.AsyncClient` instance:
|
|
154
|
+
|
|
155
|
+
```python
|
|
156
|
+
import httpx
|
|
157
|
+
|
|
158
|
+
http_client = httpx.AsyncClient(timeout=60.0)
|
|
159
|
+
auth_client = AuthenticationClient(http_client=http_client)
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
## Error Handling
|
|
163
|
+
|
|
164
|
+
```python
|
|
165
|
+
from kiota_abstractions.api_error import APIError
|
|
166
|
+
|
|
167
|
+
try:
|
|
168
|
+
token = await auth_client.helper.get_two_legged_token(client_id, client_secret, scopes)
|
|
169
|
+
except APIError as e:
|
|
170
|
+
print(f"Request failed: {e.message}")
|
|
171
|
+
print(f"Status code: {e.response_status_code}")
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
## Requirements
|
|
175
|
+
|
|
176
|
+
- Python 3.10 or later
|
|
177
|
+
- Valid Autodesk Platform Services (APS) application credentials
|
|
178
|
+
|
|
179
|
+
### Dependencies
|
|
180
|
+
|
|
181
|
+
- `microsoft-kiota-abstractions`
|
|
182
|
+
- `microsoft-kiota-http`
|
|
183
|
+
- `microsoft-kiota-serialization-json`
|
|
184
|
+
- `microsoft-kiota-serialization-text`
|
|
185
|
+
- `microsoft-kiota-serialization-form`
|
|
186
|
+
- `microsoft-kiota-serialization-multipart`
|
|
187
|
+
- `httpx`
|
|
188
|
+
|
|
189
|
+
## Documentation
|
|
190
|
+
|
|
191
|
+
- [Authentication API Documentation](https://aps.autodesk.com/en/docs/oauth/v2/overview/)
|
|
192
|
+
- [Autodesk Platform Services](https://aps.autodesk.com/)
|
|
193
|
+
- [Microsoft Kiota Documentation](https://learn.microsoft.com/en-us/openapi/kiota/overview)
|
|
194
|
+
|
|
195
|
+
## License
|
|
196
|
+
|
|
197
|
+
This project is licensed under the MIT License.
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=68.0", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "adsk-platform-authentication"
|
|
7
|
+
version = "0.2.9"
|
|
8
|
+
description = "Autodesk Platform: Authentication SDK for Python"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = "MIT"
|
|
11
|
+
requires-python = ">=3.10"
|
|
12
|
+
authors = [
|
|
13
|
+
{ name = "duszykf" },
|
|
14
|
+
]
|
|
15
|
+
keywords = [
|
|
16
|
+
"autodesk",
|
|
17
|
+
"authentication",
|
|
18
|
+
"aps",
|
|
19
|
+
"oauth",
|
|
20
|
+
"kiota",
|
|
21
|
+
"sdk",
|
|
22
|
+
]
|
|
23
|
+
classifiers = [
|
|
24
|
+
"Development Status :: 3 - Alpha",
|
|
25
|
+
"Intended Audience :: Developers",
|
|
26
|
+
"Operating System :: OS Independent",
|
|
27
|
+
"Programming Language :: Python :: 3",
|
|
28
|
+
"Programming Language :: Python :: 3.10",
|
|
29
|
+
"Programming Language :: Python :: 3.11",
|
|
30
|
+
"Programming Language :: Python :: 3.12",
|
|
31
|
+
"Programming Language :: Python :: 3.13",
|
|
32
|
+
"Programming Language :: Python :: 3.14",
|
|
33
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
34
|
+
"Typing :: Typed",
|
|
35
|
+
]
|
|
36
|
+
dependencies = [
|
|
37
|
+
"adsk-platform-httpclient>=0.1.0,<1.0.0",
|
|
38
|
+
"microsoft-kiota-abstractions>=1.9.0,<2.0.0",
|
|
39
|
+
"microsoft-kiota-http>=1.9.0,<2.0.0",
|
|
40
|
+
"microsoft-kiota-serialization-json>=1.9.0,<2.0.0",
|
|
41
|
+
"microsoft-kiota-serialization-text>=1.9.0,<2.0.0",
|
|
42
|
+
"microsoft-kiota-serialization-form>=1.9.0,<2.0.0",
|
|
43
|
+
"microsoft-kiota-serialization-multipart>=1.9.0,<2.0.0",
|
|
44
|
+
"httpx>=0.27.0,<1.0.0",
|
|
45
|
+
]
|
|
46
|
+
|
|
47
|
+
[project.urls]
|
|
48
|
+
Documentation = "https://aps.autodesk.com/en/docs/oauth/v2/overview/"
|
|
49
|
+
Repository = "https://github.com/Autodesk/APS-SDK-Kiota"
|
|
50
|
+
Issues = "https://github.com/Autodesk/APS-SDK-Kiota/issues"
|
|
51
|
+
|
|
52
|
+
[tool.setuptools.packages.find]
|
|
53
|
+
where = ["src"]
|
|
54
|
+
|
|
55
|
+
[tool.setuptools.package-data]
|
|
56
|
+
"autodesk_authentication.generated_code" = ["kiota-lock.json"]
|