snaptrade-python-sdk 13.2.1__py3-none-any.whl → 13.3.0__py3-none-any.whl
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.
- snaptrade_client/__init__.py +2 -1
- snaptrade_client/api_client.py +1 -1
- snaptrade_client/configuration.py +1 -1
- snaptrade_client/oauth.py +267 -0
- {snaptrade_python_sdk-13.2.1.dist-info → snaptrade_python_sdk-13.3.0.dist-info}/METADATA +30 -3
- {snaptrade_python_sdk-13.2.1.dist-info → snaptrade_python_sdk-13.3.0.dist-info}/RECORD +8 -7
- {snaptrade_python_sdk-13.2.1.dist-info → snaptrade_python_sdk-13.3.0.dist-info}/LICENSE +0 -0
- {snaptrade_python_sdk-13.2.1.dist-info → snaptrade_python_sdk-13.3.0.dist-info}/WHEEL +0 -0
snaptrade_client/__init__.py
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
Created by: https://snaptrade.com/
|
|
13
13
|
"""
|
|
14
14
|
|
|
15
|
-
__version__ = "13.
|
|
15
|
+
__version__ = "13.3.0"
|
|
16
16
|
|
|
17
17
|
# import ApiClient
|
|
18
18
|
from snaptrade_client.api_client import ApiClient
|
|
@@ -20,6 +20,7 @@ from snaptrade_client.api_client import ApiClient
|
|
|
20
20
|
# import Configuration
|
|
21
21
|
from snaptrade_client.configuration import Configuration
|
|
22
22
|
from snaptrade_client.auth import SnapTradeAuth, AuthMode, CommercialApiKeyAuth, PersonalApiKeyAuth, OAuthAuth
|
|
23
|
+
from snaptrade_client.oauth import SnapTradeOAuth, SnapTradeOAuthAuthorizationFlow, SnapTradeOAuthTokenResponse
|
|
23
24
|
from snaptrade_client.oauth_device import SnapTradeOAuthDevice, SnapTradeDeviceAuthorization, SnapTradeDeviceTokens, SnapTradeOAuthDeviceError
|
|
24
25
|
|
|
25
26
|
# import exceptions
|
snaptrade_client/api_client.py
CHANGED
|
@@ -1175,7 +1175,7 @@ class ApiClient(typing.Generic[TAuth]):
|
|
|
1175
1175
|
self.default_headers[header_name] = header_value
|
|
1176
1176
|
self.cookie = cookie
|
|
1177
1177
|
# Set default User-Agent.
|
|
1178
|
-
self.user_agent = 'Konfig/13.
|
|
1178
|
+
self.user_agent = 'Konfig/13.3.0/python'
|
|
1179
1179
|
|
|
1180
1180
|
def __enter__(self):
|
|
1181
1181
|
return self
|
|
@@ -537,7 +537,7 @@ conf = snaptrade_client.Configuration(
|
|
|
537
537
|
"OS: {env}\n"\
|
|
538
538
|
"Python Version: {pyversion}\n"\
|
|
539
539
|
"Version of the API: 1.0.0\n"\
|
|
540
|
-
"SDK Package Version: 13.
|
|
540
|
+
"SDK Package Version: 13.3.0".\
|
|
541
541
|
format(env=sys.platform, pyversion=sys.version)
|
|
542
542
|
|
|
543
543
|
def get_host_settings(self):
|
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
SnapTrade
|
|
5
|
+
|
|
6
|
+
Connect brokerage accounts to your app for live positions and trading. ## Rate limiting Two limits apply to requests signed with your `clientId`. The stricter one wins, and exceeding either returns `429 Too Many Requests`. - **Customer-level** — 250 requests/minute by default, scoped to your `clientId` and applied across all endpoints. Reported in `X-RateLimit-Limit`, `X-RateLimit-Remaining` and `X-RateLimit-Reset`. - **Account-level** — 10 requests/minute per account, scoped to (`clientId`, `accountId`). All covered operations for one account draw on the same bucket — reading balances and reading positions share it — and enforcement does not depend on the HTTP method, so updating an account consumes the same bucket as reading it. Only enforced for Personal users, and only for integrations it has been rolled out to — it is not yet in force for every Personal integration. It also does not apply on every operation that documents a 429 below. Where it applies it is reported in `X-RateLimit-Account-Limit`, `X-RateLimit-Account-Remaining` and `X-RateLimit-Account-Reset`. Do not read the absence of those headers as proof the limit is off — some configurations omit the rate limit headers while still enforcing the limit, so header absence tells you nothing about your allowance. On a 429, `X-RateLimit-Remaining: 0` means you hit the customer-level limit and `X-RateLimit-Account-Remaining: 0` means the account-level one. Wait for the corresponding `*-Reset` value (seconds) before retrying, or fall back to exponential backoff with jitter. Not every 429 is explained by those headers. A separate per-authenticated-user limit, reported in no `X-RateLimit-*` header, covers OAuth-authenticated requests and signed requests in configurations where the customer-level limit is not in effect — on the operations that use the default throttles. A few operations override those and are governed by the customer-level limit alone. The two do not stack: a signed request governed by the customer-level limit above is not additionally subject to the per-user one. If a 429 arrives with no header at zero — or with no `X-RateLimit-*` headers at all — honour `Retry-After` and back off. Treat the remaining counts as a hint, not a guarantee that the next request will succeed. Because the customer-level limit applies everywhere, any signed request can return 429. **OAuth-authenticated requests are an exception.** They are not subject to the customer-level limit and do not receive `X-RateLimit-Limit`, `X-RateLimit-Remaining` or `X-RateLimit-Reset` — do not wait on those headers or design around a customer-level allowance on this path. The account-level limit still applies to them on the account-data endpoints above, reported in the `X-RateLimit-Account-*` headers. On operations using the default throttles the per-user limit above applies to them as well, so an OAuth request can be rejected while the account headers still show capacity; on the few operations that override those throttles, OAuth callers have no per-user ceiling at all. Drive retries from `Retry-After` and exponential backoff with jitter rather than from the headers. See https://docs.snaptrade.com/docs/ratelimiting.
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 1.0.0
|
|
9
|
+
Contact: api@snaptrade.com
|
|
10
|
+
Created by: https://snaptrade.com/
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
from dataclasses import dataclass
|
|
14
|
+
import base64
|
|
15
|
+
import hashlib
|
|
16
|
+
import json
|
|
17
|
+
import secrets
|
|
18
|
+
import typing
|
|
19
|
+
import urllib.parse
|
|
20
|
+
import urllib.request
|
|
21
|
+
import urllib.error
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
SnapTradeOAuthScope = str
|
|
25
|
+
SnapTradeOAuthClientAuthMethod = typing.Literal["none", "client_secret_post", "client_secret_basic"]
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
@dataclass
|
|
29
|
+
class SnapTradeOAuthAuthorizationFlow:
|
|
30
|
+
url: str
|
|
31
|
+
state: str
|
|
32
|
+
code_verifier: str
|
|
33
|
+
code_challenge: str
|
|
34
|
+
scope: str
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
@dataclass
|
|
38
|
+
class SnapTradeOAuthTokenResponse:
|
|
39
|
+
access_token: str
|
|
40
|
+
refresh_token: typing.Optional[str]
|
|
41
|
+
token_type: typing.Optional[str]
|
|
42
|
+
expires_in: typing.Optional[int]
|
|
43
|
+
scope: typing.Optional[str]
|
|
44
|
+
raw: typing.Dict[str, typing.Any]
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
@dataclass
|
|
48
|
+
class _ResolvedEndpoints:
|
|
49
|
+
authorization_endpoint: str
|
|
50
|
+
token_endpoint: str
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
def _trim_trailing_slash(value: str) -> str:
|
|
54
|
+
return value.rstrip("/")
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def _origin(value: str) -> str:
|
|
58
|
+
parsed = urllib.parse.urlparse(value)
|
|
59
|
+
if not parsed.scheme or not parsed.netloc:
|
|
60
|
+
raise ValueError("OAuth issuer must be an absolute URL.")
|
|
61
|
+
return f"{parsed.scheme}://{parsed.netloc}"
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
def _to_base64_url(data: bytes) -> str:
|
|
65
|
+
return base64.urlsafe_b64encode(data).decode("ascii").rstrip("=")
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
def _random_base64_url(byte_length: int) -> str:
|
|
69
|
+
return _to_base64_url(secrets.token_bytes(byte_length))
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
def _sha256_base64_url(value: str) -> str:
|
|
73
|
+
return _to_base64_url(hashlib.sha256(value.encode("utf-8")).digest())
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
def _encode_basic_auth(client_id: str, client_secret: str) -> str:
|
|
77
|
+
return base64.b64encode(f"{client_id}:{client_secret}".encode("utf-8")).decode("ascii")
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
def _json_request(
|
|
81
|
+
url: str,
|
|
82
|
+
*,
|
|
83
|
+
method: str = "GET",
|
|
84
|
+
body: typing.Optional[typing.Union[typing.Dict[str, typing.Any], str]] = None,
|
|
85
|
+
headers: typing.Optional[typing.Dict[str, str]] = None,
|
|
86
|
+
timeout: typing.Optional[float] = None,
|
|
87
|
+
) -> typing.Dict[str, typing.Any]:
|
|
88
|
+
request_headers = dict(headers or {})
|
|
89
|
+
data = None
|
|
90
|
+
if isinstance(body, dict):
|
|
91
|
+
data = json.dumps(body).encode("utf-8")
|
|
92
|
+
request_headers.setdefault("Content-Type", "application/json")
|
|
93
|
+
elif isinstance(body, str):
|
|
94
|
+
data = body.encode("utf-8")
|
|
95
|
+
|
|
96
|
+
request = urllib.request.Request(url, data=data, headers=request_headers, method=method)
|
|
97
|
+
try:
|
|
98
|
+
urlopen_kwargs = {}
|
|
99
|
+
if timeout is not None:
|
|
100
|
+
urlopen_kwargs["timeout"] = timeout
|
|
101
|
+
with urllib.request.urlopen(request, **urlopen_kwargs) as response:
|
|
102
|
+
response_body = response.read()
|
|
103
|
+
except urllib.error.HTTPError as exc:
|
|
104
|
+
details = exc.read().decode("utf-8", errors="replace")
|
|
105
|
+
raise RuntimeError(f"OAuth request failed with status {exc.code}: {details}") from exc
|
|
106
|
+
|
|
107
|
+
parsed = json.loads(response_body or b"{}")
|
|
108
|
+
if not isinstance(parsed, dict):
|
|
109
|
+
raise RuntimeError("OAuth response body was not a JSON object.")
|
|
110
|
+
return parsed
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
def _normalize_token_response(raw: typing.Dict[str, typing.Any]) -> SnapTradeOAuthTokenResponse:
|
|
114
|
+
access_token = raw.get("access_token")
|
|
115
|
+
if not isinstance(access_token, str) or not access_token:
|
|
116
|
+
raise RuntimeError("OAuth token response did not include an access_token.")
|
|
117
|
+
return SnapTradeOAuthTokenResponse(
|
|
118
|
+
access_token=access_token,
|
|
119
|
+
refresh_token=raw.get("refresh_token") if isinstance(raw.get("refresh_token"), str) else None,
|
|
120
|
+
token_type=raw.get("token_type") if isinstance(raw.get("token_type"), str) else None,
|
|
121
|
+
expires_in=raw.get("expires_in") if isinstance(raw.get("expires_in"), int) else None,
|
|
122
|
+
scope=raw.get("scope") if isinstance(raw.get("scope"), str) else None,
|
|
123
|
+
raw=raw,
|
|
124
|
+
)
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
class SnapTradeOAuth:
|
|
128
|
+
def __init__(
|
|
129
|
+
self,
|
|
130
|
+
*,
|
|
131
|
+
client_id: str,
|
|
132
|
+
redirect_uri: str,
|
|
133
|
+
client_secret: typing.Optional[str] = None,
|
|
134
|
+
client_auth_method: typing.Optional[SnapTradeOAuthClientAuthMethod] = None,
|
|
135
|
+
issuer: typing.Optional[str] = None,
|
|
136
|
+
authorization_endpoint: typing.Optional[str] = None,
|
|
137
|
+
token_endpoint: typing.Optional[str] = None,
|
|
138
|
+
timeout: typing.Optional[float] = None,
|
|
139
|
+
):
|
|
140
|
+
self.issuer = _trim_trailing_slash(_origin(issuer or "https://api.snaptrade.com"))
|
|
141
|
+
self.authorization_endpoint = authorization_endpoint
|
|
142
|
+
self.token_endpoint = token_endpoint
|
|
143
|
+
self.client_id = client_id
|
|
144
|
+
self.redirect_uri = redirect_uri
|
|
145
|
+
self.client_secret = client_secret
|
|
146
|
+
self.client_auth_method = client_auth_method
|
|
147
|
+
self.timeout = timeout
|
|
148
|
+
self._endpoints: typing.Optional[_ResolvedEndpoints] = None
|
|
149
|
+
self._metadata: typing.Optional[typing.Dict[str, typing.Any]] = None
|
|
150
|
+
|
|
151
|
+
def create_authorization_url(
|
|
152
|
+
self,
|
|
153
|
+
*,
|
|
154
|
+
state: typing.Optional[str] = None,
|
|
155
|
+
scope: str = "read",
|
|
156
|
+
code_verifier: typing.Optional[str] = None,
|
|
157
|
+
) -> SnapTradeOAuthAuthorizationFlow:
|
|
158
|
+
endpoints = self._resolve_endpoints()
|
|
159
|
+
resolved_state = state or _random_base64_url(24)
|
|
160
|
+
resolved_code_verifier = code_verifier or _random_base64_url(32)
|
|
161
|
+
resolved_code_challenge = _sha256_base64_url(resolved_code_verifier)
|
|
162
|
+
query = urllib.parse.urlencode({
|
|
163
|
+
"response_type": "code",
|
|
164
|
+
"client_id": self.client_id,
|
|
165
|
+
"redirect_uri": self.redirect_uri,
|
|
166
|
+
"scope": scope,
|
|
167
|
+
"state": resolved_state,
|
|
168
|
+
"code_challenge": resolved_code_challenge,
|
|
169
|
+
"code_challenge_method": "S256",
|
|
170
|
+
})
|
|
171
|
+
separator = "&" if urllib.parse.urlparse(endpoints.authorization_endpoint).query else "?"
|
|
172
|
+
return SnapTradeOAuthAuthorizationFlow(
|
|
173
|
+
url=f"{endpoints.authorization_endpoint}{separator}{query}",
|
|
174
|
+
state=resolved_state,
|
|
175
|
+
code_verifier=resolved_code_verifier,
|
|
176
|
+
code_challenge=resolved_code_challenge,
|
|
177
|
+
scope=scope,
|
|
178
|
+
)
|
|
179
|
+
|
|
180
|
+
def exchange_code(
|
|
181
|
+
self,
|
|
182
|
+
*,
|
|
183
|
+
code: str,
|
|
184
|
+
code_verifier: str,
|
|
185
|
+
) -> SnapTradeOAuthTokenResponse:
|
|
186
|
+
return self._post_token_request(
|
|
187
|
+
{
|
|
188
|
+
"grant_type": "authorization_code",
|
|
189
|
+
"code": code,
|
|
190
|
+
"client_id": self.client_id,
|
|
191
|
+
"redirect_uri": self.redirect_uri,
|
|
192
|
+
"code_verifier": code_verifier,
|
|
193
|
+
},
|
|
194
|
+
)
|
|
195
|
+
|
|
196
|
+
def refresh_token(
|
|
197
|
+
self,
|
|
198
|
+
*,
|
|
199
|
+
refresh_token: str,
|
|
200
|
+
) -> SnapTradeOAuthTokenResponse:
|
|
201
|
+
return self._post_token_request(
|
|
202
|
+
{
|
|
203
|
+
"grant_type": "refresh_token",
|
|
204
|
+
"refresh_token": refresh_token,
|
|
205
|
+
"client_id": self.client_id,
|
|
206
|
+
},
|
|
207
|
+
)
|
|
208
|
+
|
|
209
|
+
def _resolve_endpoints(self) -> _ResolvedEndpoints:
|
|
210
|
+
if self.authorization_endpoint and self.token_endpoint:
|
|
211
|
+
return _ResolvedEndpoints(
|
|
212
|
+
authorization_endpoint=self.authorization_endpoint,
|
|
213
|
+
token_endpoint=self.token_endpoint,
|
|
214
|
+
)
|
|
215
|
+
if self._endpoints is None:
|
|
216
|
+
self._endpoints = self._discover_endpoints()
|
|
217
|
+
return self._endpoints
|
|
218
|
+
|
|
219
|
+
def _discover_endpoints(self) -> _ResolvedEndpoints:
|
|
220
|
+
metadata = self._fetch_server_metadata()
|
|
221
|
+
authorization_endpoint = self.authorization_endpoint or metadata.get("authorization_endpoint")
|
|
222
|
+
token_endpoint = self.token_endpoint or metadata.get("token_endpoint")
|
|
223
|
+
if not authorization_endpoint or not token_endpoint:
|
|
224
|
+
raise RuntimeError("OAuth server metadata did not include authorization_endpoint and token_endpoint.")
|
|
225
|
+
return _ResolvedEndpoints(
|
|
226
|
+
authorization_endpoint=authorization_endpoint,
|
|
227
|
+
token_endpoint=token_endpoint,
|
|
228
|
+
)
|
|
229
|
+
|
|
230
|
+
def _fetch_server_metadata(self) -> typing.Dict[str, typing.Any]:
|
|
231
|
+
if self._metadata is None:
|
|
232
|
+
self._metadata = _json_request(
|
|
233
|
+
f"{self.issuer}/.well-known/oauth-authorization-server",
|
|
234
|
+
timeout=self.timeout,
|
|
235
|
+
)
|
|
236
|
+
return self._metadata
|
|
237
|
+
|
|
238
|
+
def _post_token_request(
|
|
239
|
+
self,
|
|
240
|
+
body: typing.Dict[str, str],
|
|
241
|
+
) -> SnapTradeOAuthTokenResponse:
|
|
242
|
+
endpoints = self._resolve_endpoints()
|
|
243
|
+
client_id = self.client_id
|
|
244
|
+
client_secret = self.client_secret
|
|
245
|
+
resolved_client_auth_method = self.client_auth_method or ("client_secret_basic" if client_secret else "none")
|
|
246
|
+
request_body = dict(body)
|
|
247
|
+
headers = {"Content-Type": "application/x-www-form-urlencoded"}
|
|
248
|
+
|
|
249
|
+
if resolved_client_auth_method == "client_secret_post":
|
|
250
|
+
if not client_secret:
|
|
251
|
+
raise RuntimeError("client_secret is required when client_auth_method is client_secret_post.")
|
|
252
|
+
request_body["client_secret"] = client_secret
|
|
253
|
+
elif resolved_client_auth_method == "client_secret_basic":
|
|
254
|
+
if not client_secret:
|
|
255
|
+
raise RuntimeError("client_secret is required when client_auth_method is client_secret_basic.")
|
|
256
|
+
headers["Authorization"] = f"Basic {_encode_basic_auth(client_id, client_secret)}"
|
|
257
|
+
elif resolved_client_auth_method != "none":
|
|
258
|
+
raise RuntimeError(f"Unsupported OAuth client_auth_method: {resolved_client_auth_method}")
|
|
259
|
+
|
|
260
|
+
raw = _json_request(
|
|
261
|
+
endpoints.token_endpoint,
|
|
262
|
+
method="POST",
|
|
263
|
+
body=urllib.parse.urlencode(request_body),
|
|
264
|
+
headers=headers,
|
|
265
|
+
timeout=self.timeout,
|
|
266
|
+
)
|
|
267
|
+
return _normalize_token_response(raw)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: snaptrade-python-sdk
|
|
3
|
-
Version: 13.
|
|
3
|
+
Version: 13.3.0
|
|
4
4
|
Summary: Client for SnapTrade
|
|
5
5
|
License: MIT
|
|
6
6
|
Author: SnapTrade
|
|
@@ -87,7 +87,7 @@ See https://docs.snaptrade.com/docs/ratelimiting.
|
|
|
87
87
|
|
|
88
88
|
|
|
89
89
|
|
|
90
|
-
[](https://pypi.org/project/snaptrade-python-sdk/13.3.0)
|
|
91
91
|
[](https://github.com/passiv/snaptrade-sdks/tree/master/sdks/python#readme)
|
|
92
92
|
[](https://snaptrade.com/)
|
|
93
93
|
|
|
@@ -104,6 +104,7 @@ See https://docs.snaptrade.com/docs/ratelimiting.
|
|
|
104
104
|
* [Personal API Key Auth authentication](#personal-api-key-auth-authentication)
|
|
105
105
|
* [OAuth Auth authentication](#oauth-auth-authentication)
|
|
106
106
|
* [Device login](#device-login)
|
|
107
|
+
* [Browser OAuth and explicit refresh](#browser-oauth-and-explicit-refresh)
|
|
107
108
|
- [Getting Started](#getting-started)
|
|
108
109
|
- [Request timeouts](#request-timeouts)
|
|
109
110
|
- [Async](#async)
|
|
@@ -183,7 +184,7 @@ Python >=3.8
|
|
|
183
184
|
## Installation<a id="installation"></a>
|
|
184
185
|
|
|
185
186
|
```sh
|
|
186
|
-
pip install snaptrade-python-sdk==13.
|
|
187
|
+
pip install snaptrade-python-sdk==13.3.0
|
|
187
188
|
```
|
|
188
189
|
|
|
189
190
|
## Authentication<a id="authentication"></a>
|
|
@@ -257,6 +258,32 @@ interrupt polling waits. An in-flight request is bounded by the HTTP timeout
|
|
|
257
258
|
`SnapTradeOAuthDeviceError` and inspect `.error` for denial, expiry or cancellation.
|
|
258
259
|
Applications own token storage and refresh, including refresh-token rotation.
|
|
259
260
|
|
|
261
|
+
### Browser OAuth and explicit refresh<a id="browser-oauth-and-explicit-refresh"></a>
|
|
262
|
+
|
|
263
|
+
Configure confidential-client credentials on your backend. The synchronous helper generates fresh state and S256 PKCE and uses server discovery by default. Run blocking calls in a worker thread in asynchronous apps.
|
|
264
|
+
|
|
265
|
+
```python
|
|
266
|
+
from snaptrade_client import SnapTrade, SnapTradeAuth, SnapTradeOAuth
|
|
267
|
+
|
|
268
|
+
oauth = SnapTradeOAuth(
|
|
269
|
+
client_id=client_id, client_secret=client_secret, redirect_uri=redirect_uri
|
|
270
|
+
)
|
|
271
|
+
flow = oauth.create_authorization_url(scope="read")
|
|
272
|
+
# Save flow in the user's login session, then redirect to flow.url.
|
|
273
|
+
# In the callback, handle OAuth errors, validate state, and consume that saved flow.
|
|
274
|
+
tokens = oauth.exchange_code(code=code, code_verifier=flow.code_verifier)
|
|
275
|
+
client = SnapTrade(auth=SnapTradeAuth.oauth(access_token=tokens.access_token))
|
|
276
|
+
|
|
277
|
+
# Refresh explicitly and atomically replace the stored response, including the rotated refresh token.
|
|
278
|
+
assert tokens.refresh_token is not None
|
|
279
|
+
refreshed = oauth.refresh_token(refresh_token=tokens.refresh_token)
|
|
280
|
+
refreshed_client = SnapTrade(
|
|
281
|
+
auth=SnapTradeAuth.oauth(access_token=refreshed.access_token)
|
|
282
|
+
)
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
Token responses include `access_token`, `refresh_token`, `expires_in`, `token_type`, `scope`, and `raw`. Applications own token storage, callback validation, refresh scheduling and concurrency. A configured secret defaults to `client_secret_basic`; public clients omit the secret. Browser code must never receive a confidential-client secret.
|
|
286
|
+
|
|
260
287
|
## Getting Started<a id="getting-started"></a>
|
|
261
288
|
|
|
262
289
|
```python
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
snaptrade_client/__init__.py,sha256=
|
|
2
|
-
snaptrade_client/api_client.py,sha256=
|
|
1
|
+
snaptrade_client/__init__.py,sha256=WOkWOLO0TUV6bKOGH5HSyT6UbHVs7ZxBo3npl0EnrZM,4370
|
|
2
|
+
snaptrade_client/api_client.py,sha256=8YU6AfoSIqSIYstnsYCQO9SqrMdCTHmX8WHsNl0Fl1Q,78308
|
|
3
3
|
snaptrade_client/api_response.py,sha256=mZn18p_TNr6OY0HXTZW5InL9iXfqsJWstYGeGD-euPA,663
|
|
4
4
|
snaptrade_client/apis/__init__.py,sha256=RTosXhMn41tMsKPUjIy-VK-_efOWzhkKiuGggJ3A6E0,214
|
|
5
5
|
snaptrade_client/apis/path_to_api.py,sha256=xHjhZWAnlLIvvtGOQYUE-WmdDRZqhgkpB_auzT3rHG8,16169
|
|
@@ -89,7 +89,7 @@ snaptrade_client/auth.py,sha256=85VAIdB-s7SGAHoU0xZnPd7pc680Y58ILZgRiKVn2pk,4797
|
|
|
89
89
|
snaptrade_client/client.py,sha256=ncRPbSzbjqr4YVdjzfm8IrCgFhawclXFRlYJzkHNu98,6361
|
|
90
90
|
snaptrade_client/client.pyi,sha256=s5mcwbmAEVZMJrZOT3fTP9-_r7rf2L0qdJiX8RlnX9o,6358
|
|
91
91
|
snaptrade_client/client_custom.py,sha256=hNQMRFrY_KWEOCgf36fsZBs3sBU2SQtnZin8dAEVyYo,3931
|
|
92
|
-
snaptrade_client/configuration.py,sha256=
|
|
92
|
+
snaptrade_client/configuration.py,sha256=i5rgB_j66UDRUsdzY2bEFFXthf1ntwIks2mmq889G9c,26562
|
|
93
93
|
snaptrade_client/exceptions.py,sha256=pRlZiy1hSulcXfTCqqBU5Jys0hRBkxljOiv212M_yeo,10957
|
|
94
94
|
snaptrade_client/exceptions_base.py,sha256=LAQkaC5C61-SdBLfyMjb0K7AYJkWVuLmg2uCvHa71FM,2274
|
|
95
95
|
snaptrade_client/model/__init__.py,sha256=ayi2MIzcf0eAIsY13ToiNplV9tW-pMBFrC0I9yckGM8,350
|
|
@@ -674,6 +674,7 @@ snaptrade_client/model/user_secret.pyi,sha256=BiF8M99Os_WXMHiGaivayDrU53MNuyr2Zj
|
|
|
674
674
|
snaptrade_client/model/validated_trade_body.py,sha256=KOObe8mGtKr29bjV0l7cdiqKJQn3E22WqNIfHG-1Kig,6271
|
|
675
675
|
snaptrade_client/model/validated_trade_body.pyi,sha256=KOObe8mGtKr29bjV0l7cdiqKJQn3E22WqNIfHG-1Kig,6271
|
|
676
676
|
snaptrade_client/models/__init__.py,sha256=E9m_lnITxLRwD-bl4a5KWafO0hXIhFgXmGyb3PYIMm0,23526
|
|
677
|
+
snaptrade_client/oauth.py,sha256=ucxZolFtXB8t3kaTiGcZi-UeLGgfc8qz-KmP-VEUipA,12852
|
|
677
678
|
snaptrade_client/oauth_device.py,sha256=mgH6ak8zRa0YCLKzd_rKctpS2e71OeC0QHbetQICSWY,10511
|
|
678
679
|
snaptrade_client/operation_parameter_map.py,sha256=3yq6LEXUrKBoJr3GndRRcv91ARt5EjJ5WN5mxI7byrM,16333
|
|
679
680
|
snaptrade_client/paths/__init__.py,sha256=yaQWUIwysHW1tT2SwK_Cwg23E_669h0dWNBPmyJNMW0,4674
|
|
@@ -1170,7 +1171,7 @@ snaptrade_client/type/user_secret.py,sha256=B6gpY5ECG6fV4aCV7XH9TK9uW9UsZYZlng56
|
|
|
1170
1171
|
snaptrade_client/type/validated_trade_body.py,sha256=3d5fH-7GtjtWxBTBDyjK2RSmoFcMQpr7Sv6MXgCfKQc,4076
|
|
1171
1172
|
snaptrade_client/type_util.py,sha256=y93VO77G7QTwguvfc3HnevIWtLat__tNZXfpSCSxHoU,3749
|
|
1172
1173
|
snaptrade_client/validation_metadata.py,sha256=VTN5y-NudHXok1X468J4PnGze_tGEAcs1v3gsXmcrb0,3172
|
|
1173
|
-
snaptrade_python_sdk-13.
|
|
1174
|
-
snaptrade_python_sdk-13.
|
|
1175
|
-
snaptrade_python_sdk-13.
|
|
1176
|
-
snaptrade_python_sdk-13.
|
|
1174
|
+
snaptrade_python_sdk-13.3.0.dist-info/LICENSE,sha256=GxvPdqYTCDLPwtMD70oHKcnAL8Os4eOjPVhERWpJ5Cs,1081
|
|
1175
|
+
snaptrade_python_sdk-13.3.0.dist-info/METADATA,sha256=8cOkoy0GMwJKV7kLbK5rRq3KPPLr3_HUzDtZOfZNZS4,209191
|
|
1176
|
+
snaptrade_python_sdk-13.3.0.dist-info/WHEEL,sha256=Zb28QaM1gQi8f4VCBhsUklF61CTlNYfs9YAZn-TOGFk,88
|
|
1177
|
+
snaptrade_python_sdk-13.3.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|