stakeapi-codestats 0.2.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.
- stakeapi_codestats-0.2.0/LICENSE +21 -0
- stakeapi_codestats-0.2.0/PKG-INFO +230 -0
- stakeapi_codestats-0.2.0/README.md +185 -0
- stakeapi_codestats-0.2.0/pyproject.toml +109 -0
- stakeapi_codestats-0.2.0/setup.cfg +4 -0
- stakeapi_codestats-0.2.0/stakeapi/__init__.py +31 -0
- stakeapi_codestats-0.2.0/stakeapi/_version.py +1 -0
- stakeapi_codestats-0.2.0/stakeapi/auth.py +138 -0
- stakeapi_codestats-0.2.0/stakeapi/client.py +695 -0
- stakeapi_codestats-0.2.0/stakeapi/endpoints.py +916 -0
- stakeapi_codestats-0.2.0/stakeapi/exceptions.py +43 -0
- stakeapi_codestats-0.2.0/stakeapi/models.py +285 -0
- stakeapi_codestats-0.2.0/stakeapi/utils.py +141 -0
- stakeapi_codestats-0.2.0/stakeapi_codestats.egg-info/PKG-INFO +230 -0
- stakeapi_codestats-0.2.0/stakeapi_codestats.egg-info/SOURCES.txt +19 -0
- stakeapi_codestats-0.2.0/stakeapi_codestats.egg-info/dependency_links.txt +1 -0
- stakeapi_codestats-0.2.0/stakeapi_codestats.egg-info/requires.txt +20 -0
- stakeapi_codestats-0.2.0/stakeapi_codestats.egg-info/top_level.txt +1 -0
- stakeapi_codestats-0.2.0/tests/test_client.py +175 -0
- stakeapi_codestats-0.2.0/tests/test_models.py +221 -0
- stakeapi_codestats-0.2.0/tests/test_utils.py +178 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 StakeAPI Contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: stakeapi-codestats
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: Unofficial async Python wrapper for the stake.com / stake.us GraphQL API — CodeStats.gg edition
|
|
5
|
+
Author: brokechubb
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://codestats.gg
|
|
8
|
+
Project-URL: Documentation, https://brokechubb.github.io/StakeAPI/
|
|
9
|
+
Project-URL: Repository, https://github.com/brokechubb/StakeAPI
|
|
10
|
+
Project-URL: Bug Tracker, https://github.com/brokechubb/StakeAPI/issues
|
|
11
|
+
Keywords: stake,gambling,api,casino,betting,codestats,graphql,stake.us
|
|
12
|
+
Classifier: Development Status :: 3 - Alpha
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
21
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
22
|
+
Classifier: Topic :: Internet :: WWW/HTTP
|
|
23
|
+
Requires-Python: >=3.8
|
|
24
|
+
Description-Content-Type: text/markdown
|
|
25
|
+
License-File: LICENSE
|
|
26
|
+
Requires-Dist: aiohttp>=3.8.0
|
|
27
|
+
Requires-Dist: pydantic>=2.0.0
|
|
28
|
+
Requires-Dist: python-dotenv>=0.19.0
|
|
29
|
+
Requires-Dist: websockets>=10.0
|
|
30
|
+
Requires-Dist: cryptography>=3.4.8
|
|
31
|
+
Provides-Extra: dev
|
|
32
|
+
Requires-Dist: pytest>=7.0.0; extra == "dev"
|
|
33
|
+
Requires-Dist: pytest-asyncio>=0.21.0; extra == "dev"
|
|
34
|
+
Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
|
|
35
|
+
Requires-Dist: black>=22.0.0; extra == "dev"
|
|
36
|
+
Requires-Dist: isort>=5.10.0; extra == "dev"
|
|
37
|
+
Requires-Dist: flake8>=4.0.0; extra == "dev"
|
|
38
|
+
Requires-Dist: mypy>=0.910; extra == "dev"
|
|
39
|
+
Requires-Dist: pre-commit>=2.15.0; extra == "dev"
|
|
40
|
+
Provides-Extra: docs
|
|
41
|
+
Requires-Dist: sphinx>=4.0.0; extra == "docs"
|
|
42
|
+
Requires-Dist: sphinx-rtd-theme>=1.0.0; extra == "docs"
|
|
43
|
+
Requires-Dist: myst-parser>=0.15.0; extra == "docs"
|
|
44
|
+
Dynamic: license-file
|
|
45
|
+
|
|
46
|
+
# StakeAPI
|
|
47
|
+
|
|
48
|
+
### UPDATED MAY 2026
|
|
49
|
+
|
|
50
|
+
An unofficial async Python wrapper for the stake.com / stake.us GraphQL API.
|
|
51
|
+
|
|
52
|
+
## Disclaimer
|
|
53
|
+
|
|
54
|
+
This is an unofficial wrapper, not affiliated with or endorsed by Stake.com or Stake.us. Use at your own risk and ensure compliance with all applicable laws and the platform's terms of service.
|
|
55
|
+
|
|
56
|
+
## Features
|
|
57
|
+
|
|
58
|
+
- Async/await with `aiohttp`
|
|
59
|
+
- All GraphQL operations verified against live stake.com and stake.us APIs
|
|
60
|
+
- Pydantic v2 models with camelCase alias support
|
|
61
|
+
- Cloudflare bypass via `cf_clearance` cookie + matching User-Agent
|
|
62
|
+
- stake.us works with access token only — no Cloudflare cookie required
|
|
63
|
+
|
|
64
|
+
## Installation
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
pip install stakeapi-codestats
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Quick Start
|
|
71
|
+
|
|
72
|
+
```python
|
|
73
|
+
import asyncio
|
|
74
|
+
from stakeapi import StakeAPI
|
|
75
|
+
|
|
76
|
+
async def main():
|
|
77
|
+
# stake.us — access token only
|
|
78
|
+
async with StakeAPI(
|
|
79
|
+
access_token="your_token",
|
|
80
|
+
base_url="https://stake.us",
|
|
81
|
+
) as client:
|
|
82
|
+
balance = await client.get_user_balance()
|
|
83
|
+
print(balance)
|
|
84
|
+
|
|
85
|
+
asyncio.run(main())
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### stake.com (requires Cloudflare clearance)
|
|
89
|
+
|
|
90
|
+
stake.com blocks requests without a valid `cf_clearance` cookie. Get it from your browser's DevTools (Application → Cookies → `cf_clearance`) or extract it with Playwright:
|
|
91
|
+
|
|
92
|
+
```python
|
|
93
|
+
async with StakeAPI(
|
|
94
|
+
access_token="your_token",
|
|
95
|
+
cf_clearance="your_cf_clearance_cookie",
|
|
96
|
+
user_agent="Mozilla/5.0 ... Chrome/147.0.0.0 ...", # must match cookie
|
|
97
|
+
base_url="https://stake.com",
|
|
98
|
+
) as client:
|
|
99
|
+
balance = await client.get_user_balance()
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
## Getting Your Access Token
|
|
103
|
+
|
|
104
|
+
1. Log in to stake.com in your browser
|
|
105
|
+
2. Open DevTools (F12) → Network tab
|
|
106
|
+
3. Make any action that triggers a request to `/_api/graphql`
|
|
107
|
+
4. Find the `x-access-token` request header — that's your token
|
|
108
|
+
|
|
109
|
+
## API Methods
|
|
110
|
+
|
|
111
|
+
### User
|
|
112
|
+
|
|
113
|
+
| Method | Description |
|
|
114
|
+
| ------------------------------------------- | --------------------------------------- |
|
|
115
|
+
| `get_user_balance()` | Available + vault balances per currency |
|
|
116
|
+
| `get_user_profile()` | Name, email, verification status |
|
|
117
|
+
| `get_user_meta(name=None)` | Lightweight user info with balances |
|
|
118
|
+
| `get_user_meta_extended(name, signup_code)` | Extended info including self-exclude |
|
|
119
|
+
| `get_user_account_info()` | Name, email, createdAt |
|
|
120
|
+
| `get_user_kyc_status()` | KYC status (stake.com only) |
|
|
121
|
+
| `get_user_sessions()` | Active sessions with IP and location |
|
|
122
|
+
| `get_user_api_keys()` | API key list |
|
|
123
|
+
| `get_user_statistic()` | Per-currency wagering stats |
|
|
124
|
+
| `get_user_seed_pair()` | Provably fair client/server seeds |
|
|
125
|
+
| `is_user_tfa_enabled()` | 2FA status |
|
|
126
|
+
| `get_user_preferences()` | User preferences object |
|
|
127
|
+
| `get_user_recent_games(limit)` | Recently played games |
|
|
128
|
+
|
|
129
|
+
### VIP / Reload / Faucet
|
|
130
|
+
|
|
131
|
+
| Method | Description |
|
|
132
|
+
| ----------------------- | ------------------------------------- |
|
|
133
|
+
| `get_vip_meta()` | Balances + reload status combined |
|
|
134
|
+
| `get_faucet()` | Reload/faucet status |
|
|
135
|
+
| `get_active_rakeback()` | Rakeback info (permission-restricted) |
|
|
136
|
+
| `get_tip_list(limit)` | User tip history |
|
|
137
|
+
|
|
138
|
+
### Currency / Config
|
|
139
|
+
|
|
140
|
+
| Method | Description |
|
|
141
|
+
| ------------------------------------------ | ------------------------------------------------- |
|
|
142
|
+
| `get_currency_configuration(is_acp)` | Currency rates; `is_acp=True` for stake.us |
|
|
143
|
+
| `get_conversion_rates(display_currencies)` | Fiat conversion rates (lowercase enum: `["usd"]`) |
|
|
144
|
+
|
|
145
|
+
### Bonuses / Promos
|
|
146
|
+
|
|
147
|
+
| Method | Description |
|
|
148
|
+
| ------------------------------------- | ----------------------- |
|
|
149
|
+
| `check_bonus_code(code, coupon_type)` | Check code availability |
|
|
150
|
+
| `get_racing_list()` | Race/campaign list |
|
|
151
|
+
| `get_campaign_balances()` | User campaign balances |
|
|
152
|
+
|
|
153
|
+
### Transactions / History
|
|
154
|
+
|
|
155
|
+
| Method | Description |
|
|
156
|
+
| ---------------------------------------- | -------------------------------------------------- |
|
|
157
|
+
| `get_transactions(offset, limit, types)` | Transaction history with optional type filter |
|
|
158
|
+
| `get_deposits(offset, limit)` | Deposit history |
|
|
159
|
+
| `get_withdrawals(offset, limit)` | Withdrawal history |
|
|
160
|
+
| `get_my_bets(limit)` | Chat list (direct bet history unavailable via API) |
|
|
161
|
+
|
|
162
|
+
### Casino / Games
|
|
163
|
+
|
|
164
|
+
| Method | Description |
|
|
165
|
+
| ----------------------------------------- | --------------------------------------------- |
|
|
166
|
+
| `get_blackjack_active_bet()` | Active BJ bet or null |
|
|
167
|
+
| `get_kurator_collection(collection_type)` | Game collection by enum type |
|
|
168
|
+
| `get_kurator_group(slug)` | Game group by slug (e.g. `"stake-originals"`) |
|
|
169
|
+
|
|
170
|
+
### Sports (stake.com only)
|
|
171
|
+
|
|
172
|
+
| Method | Description |
|
|
173
|
+
| ----------------------- | -------------------------------------- |
|
|
174
|
+
| `get_sport_list_menu()` | Sport list (region-locked on stake.us) |
|
|
175
|
+
|
|
176
|
+
### Social / Misc
|
|
177
|
+
|
|
178
|
+
| Method | Description |
|
|
179
|
+
| ---------------------------------- | --------------------------------------- |
|
|
180
|
+
| `get_active_races()` | Active races |
|
|
181
|
+
| `get_notifications(offset, limit)` | Notification list |
|
|
182
|
+
| `get_public_chats()` | Public chat entries |
|
|
183
|
+
| `get_banned_countries()` | Banned countries (CSV in `value` field) |
|
|
184
|
+
| `get_player_count()` | Player count by scope |
|
|
185
|
+
| `get_feature_flags()` | Feature flag list |
|
|
186
|
+
|
|
187
|
+
### Mutations
|
|
188
|
+
|
|
189
|
+
| Method | Description |
|
|
190
|
+
| --------------------------------------------------- | -------------------------- |
|
|
191
|
+
| `claim_bonus_code(code, currency, turnstile_token)` | Claim a bonus code |
|
|
192
|
+
| `claim_faucet(currency, turnstile_token)` | Claim reload bonus |
|
|
193
|
+
| `claim_rakeback()` | Claim rakeback |
|
|
194
|
+
| `create_vault_deposit(currency, amount)` | Deposit to vault |
|
|
195
|
+
| `rotate_seed_pair(seed)` | Rotate provably fair seeds |
|
|
196
|
+
| `blackjack_bet(amount, currency, identifier)` | Place BJ bet |
|
|
197
|
+
| `blackjack_next(action, identifier)` | Hit/stand/double |
|
|
198
|
+
|
|
199
|
+
> **Note:** `claim_bonus_code` and `claim_faucet` require a Cloudflare Turnstile token (sitekey `0x4AAAAAAAGD4gMGOTFnvupz`), which must be generated in a browser context.
|
|
200
|
+
|
|
201
|
+
## Custom GraphQL Queries
|
|
202
|
+
|
|
203
|
+
```python
|
|
204
|
+
async with StakeAPI(access_token="token", base_url="https://stake.us") as client:
|
|
205
|
+
data = await client._graphql_request(
|
|
206
|
+
query="""
|
|
207
|
+
query UserSeedPair {
|
|
208
|
+
user {
|
|
209
|
+
id
|
|
210
|
+
activeClientSeed { seed }
|
|
211
|
+
activeServerSeed { seedHash nonce }
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
""",
|
|
215
|
+
operation_name="UserSeedPair",
|
|
216
|
+
)
|
|
217
|
+
print(data)
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
## Development
|
|
221
|
+
|
|
222
|
+
```bash
|
|
223
|
+
make install-dev # install with dev deps
|
|
224
|
+
make format # black + isort
|
|
225
|
+
make check # lint + typecheck + tests
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
## License
|
|
229
|
+
|
|
230
|
+
MIT
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
# StakeAPI
|
|
2
|
+
|
|
3
|
+
### UPDATED MAY 2026
|
|
4
|
+
|
|
5
|
+
An unofficial async Python wrapper for the stake.com / stake.us GraphQL API.
|
|
6
|
+
|
|
7
|
+
## Disclaimer
|
|
8
|
+
|
|
9
|
+
This is an unofficial wrapper, not affiliated with or endorsed by Stake.com or Stake.us. Use at your own risk and ensure compliance with all applicable laws and the platform's terms of service.
|
|
10
|
+
|
|
11
|
+
## Features
|
|
12
|
+
|
|
13
|
+
- Async/await with `aiohttp`
|
|
14
|
+
- All GraphQL operations verified against live stake.com and stake.us APIs
|
|
15
|
+
- Pydantic v2 models with camelCase alias support
|
|
16
|
+
- Cloudflare bypass via `cf_clearance` cookie + matching User-Agent
|
|
17
|
+
- stake.us works with access token only — no Cloudflare cookie required
|
|
18
|
+
|
|
19
|
+
## Installation
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
pip install stakeapi-codestats
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Quick Start
|
|
26
|
+
|
|
27
|
+
```python
|
|
28
|
+
import asyncio
|
|
29
|
+
from stakeapi import StakeAPI
|
|
30
|
+
|
|
31
|
+
async def main():
|
|
32
|
+
# stake.us — access token only
|
|
33
|
+
async with StakeAPI(
|
|
34
|
+
access_token="your_token",
|
|
35
|
+
base_url="https://stake.us",
|
|
36
|
+
) as client:
|
|
37
|
+
balance = await client.get_user_balance()
|
|
38
|
+
print(balance)
|
|
39
|
+
|
|
40
|
+
asyncio.run(main())
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### stake.com (requires Cloudflare clearance)
|
|
44
|
+
|
|
45
|
+
stake.com blocks requests without a valid `cf_clearance` cookie. Get it from your browser's DevTools (Application → Cookies → `cf_clearance`) or extract it with Playwright:
|
|
46
|
+
|
|
47
|
+
```python
|
|
48
|
+
async with StakeAPI(
|
|
49
|
+
access_token="your_token",
|
|
50
|
+
cf_clearance="your_cf_clearance_cookie",
|
|
51
|
+
user_agent="Mozilla/5.0 ... Chrome/147.0.0.0 ...", # must match cookie
|
|
52
|
+
base_url="https://stake.com",
|
|
53
|
+
) as client:
|
|
54
|
+
balance = await client.get_user_balance()
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Getting Your Access Token
|
|
58
|
+
|
|
59
|
+
1. Log in to stake.com in your browser
|
|
60
|
+
2. Open DevTools (F12) → Network tab
|
|
61
|
+
3. Make any action that triggers a request to `/_api/graphql`
|
|
62
|
+
4. Find the `x-access-token` request header — that's your token
|
|
63
|
+
|
|
64
|
+
## API Methods
|
|
65
|
+
|
|
66
|
+
### User
|
|
67
|
+
|
|
68
|
+
| Method | Description |
|
|
69
|
+
| ------------------------------------------- | --------------------------------------- |
|
|
70
|
+
| `get_user_balance()` | Available + vault balances per currency |
|
|
71
|
+
| `get_user_profile()` | Name, email, verification status |
|
|
72
|
+
| `get_user_meta(name=None)` | Lightweight user info with balances |
|
|
73
|
+
| `get_user_meta_extended(name, signup_code)` | Extended info including self-exclude |
|
|
74
|
+
| `get_user_account_info()` | Name, email, createdAt |
|
|
75
|
+
| `get_user_kyc_status()` | KYC status (stake.com only) |
|
|
76
|
+
| `get_user_sessions()` | Active sessions with IP and location |
|
|
77
|
+
| `get_user_api_keys()` | API key list |
|
|
78
|
+
| `get_user_statistic()` | Per-currency wagering stats |
|
|
79
|
+
| `get_user_seed_pair()` | Provably fair client/server seeds |
|
|
80
|
+
| `is_user_tfa_enabled()` | 2FA status |
|
|
81
|
+
| `get_user_preferences()` | User preferences object |
|
|
82
|
+
| `get_user_recent_games(limit)` | Recently played games |
|
|
83
|
+
|
|
84
|
+
### VIP / Reload / Faucet
|
|
85
|
+
|
|
86
|
+
| Method | Description |
|
|
87
|
+
| ----------------------- | ------------------------------------- |
|
|
88
|
+
| `get_vip_meta()` | Balances + reload status combined |
|
|
89
|
+
| `get_faucet()` | Reload/faucet status |
|
|
90
|
+
| `get_active_rakeback()` | Rakeback info (permission-restricted) |
|
|
91
|
+
| `get_tip_list(limit)` | User tip history |
|
|
92
|
+
|
|
93
|
+
### Currency / Config
|
|
94
|
+
|
|
95
|
+
| Method | Description |
|
|
96
|
+
| ------------------------------------------ | ------------------------------------------------- |
|
|
97
|
+
| `get_currency_configuration(is_acp)` | Currency rates; `is_acp=True` for stake.us |
|
|
98
|
+
| `get_conversion_rates(display_currencies)` | Fiat conversion rates (lowercase enum: `["usd"]`) |
|
|
99
|
+
|
|
100
|
+
### Bonuses / Promos
|
|
101
|
+
|
|
102
|
+
| Method | Description |
|
|
103
|
+
| ------------------------------------- | ----------------------- |
|
|
104
|
+
| `check_bonus_code(code, coupon_type)` | Check code availability |
|
|
105
|
+
| `get_racing_list()` | Race/campaign list |
|
|
106
|
+
| `get_campaign_balances()` | User campaign balances |
|
|
107
|
+
|
|
108
|
+
### Transactions / History
|
|
109
|
+
|
|
110
|
+
| Method | Description |
|
|
111
|
+
| ---------------------------------------- | -------------------------------------------------- |
|
|
112
|
+
| `get_transactions(offset, limit, types)` | Transaction history with optional type filter |
|
|
113
|
+
| `get_deposits(offset, limit)` | Deposit history |
|
|
114
|
+
| `get_withdrawals(offset, limit)` | Withdrawal history |
|
|
115
|
+
| `get_my_bets(limit)` | Chat list (direct bet history unavailable via API) |
|
|
116
|
+
|
|
117
|
+
### Casino / Games
|
|
118
|
+
|
|
119
|
+
| Method | Description |
|
|
120
|
+
| ----------------------------------------- | --------------------------------------------- |
|
|
121
|
+
| `get_blackjack_active_bet()` | Active BJ bet or null |
|
|
122
|
+
| `get_kurator_collection(collection_type)` | Game collection by enum type |
|
|
123
|
+
| `get_kurator_group(slug)` | Game group by slug (e.g. `"stake-originals"`) |
|
|
124
|
+
|
|
125
|
+
### Sports (stake.com only)
|
|
126
|
+
|
|
127
|
+
| Method | Description |
|
|
128
|
+
| ----------------------- | -------------------------------------- |
|
|
129
|
+
| `get_sport_list_menu()` | Sport list (region-locked on stake.us) |
|
|
130
|
+
|
|
131
|
+
### Social / Misc
|
|
132
|
+
|
|
133
|
+
| Method | Description |
|
|
134
|
+
| ---------------------------------- | --------------------------------------- |
|
|
135
|
+
| `get_active_races()` | Active races |
|
|
136
|
+
| `get_notifications(offset, limit)` | Notification list |
|
|
137
|
+
| `get_public_chats()` | Public chat entries |
|
|
138
|
+
| `get_banned_countries()` | Banned countries (CSV in `value` field) |
|
|
139
|
+
| `get_player_count()` | Player count by scope |
|
|
140
|
+
| `get_feature_flags()` | Feature flag list |
|
|
141
|
+
|
|
142
|
+
### Mutations
|
|
143
|
+
|
|
144
|
+
| Method | Description |
|
|
145
|
+
| --------------------------------------------------- | -------------------------- |
|
|
146
|
+
| `claim_bonus_code(code, currency, turnstile_token)` | Claim a bonus code |
|
|
147
|
+
| `claim_faucet(currency, turnstile_token)` | Claim reload bonus |
|
|
148
|
+
| `claim_rakeback()` | Claim rakeback |
|
|
149
|
+
| `create_vault_deposit(currency, amount)` | Deposit to vault |
|
|
150
|
+
| `rotate_seed_pair(seed)` | Rotate provably fair seeds |
|
|
151
|
+
| `blackjack_bet(amount, currency, identifier)` | Place BJ bet |
|
|
152
|
+
| `blackjack_next(action, identifier)` | Hit/stand/double |
|
|
153
|
+
|
|
154
|
+
> **Note:** `claim_bonus_code` and `claim_faucet` require a Cloudflare Turnstile token (sitekey `0x4AAAAAAAGD4gMGOTFnvupz`), which must be generated in a browser context.
|
|
155
|
+
|
|
156
|
+
## Custom GraphQL Queries
|
|
157
|
+
|
|
158
|
+
```python
|
|
159
|
+
async with StakeAPI(access_token="token", base_url="https://stake.us") as client:
|
|
160
|
+
data = await client._graphql_request(
|
|
161
|
+
query="""
|
|
162
|
+
query UserSeedPair {
|
|
163
|
+
user {
|
|
164
|
+
id
|
|
165
|
+
activeClientSeed { seed }
|
|
166
|
+
activeServerSeed { seedHash nonce }
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
""",
|
|
170
|
+
operation_name="UserSeedPair",
|
|
171
|
+
)
|
|
172
|
+
print(data)
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
## Development
|
|
176
|
+
|
|
177
|
+
```bash
|
|
178
|
+
make install-dev # install with dev deps
|
|
179
|
+
make format # black + isort
|
|
180
|
+
make check # lint + typecheck + tests
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
## License
|
|
184
|
+
|
|
185
|
+
MIT
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=45", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "stakeapi-codestats"
|
|
7
|
+
version = "0.2.0"
|
|
8
|
+
description = "Unofficial async Python wrapper for the stake.com / stake.us GraphQL API — CodeStats.gg edition"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.8"
|
|
11
|
+
license = {text = "MIT"}
|
|
12
|
+
authors = [
|
|
13
|
+
{name = "brokechubb"},
|
|
14
|
+
]
|
|
15
|
+
keywords = ["stake", "gambling", "api", "casino", "betting", "codestats", "graphql", "stake.us"]
|
|
16
|
+
classifiers = [
|
|
17
|
+
"Development Status :: 3 - Alpha",
|
|
18
|
+
"Intended Audience :: Developers",
|
|
19
|
+
"License :: OSI Approved :: MIT License",
|
|
20
|
+
"Programming Language :: Python :: 3",
|
|
21
|
+
"Programming Language :: Python :: 3.8",
|
|
22
|
+
"Programming Language :: Python :: 3.9",
|
|
23
|
+
"Programming Language :: Python :: 3.10",
|
|
24
|
+
"Programming Language :: Python :: 3.11",
|
|
25
|
+
"Programming Language :: Python :: 3.12",
|
|
26
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
27
|
+
"Topic :: Internet :: WWW/HTTP",
|
|
28
|
+
]
|
|
29
|
+
dependencies = [
|
|
30
|
+
"aiohttp>=3.8.0",
|
|
31
|
+
"pydantic>=2.0.0",
|
|
32
|
+
"python-dotenv>=0.19.0",
|
|
33
|
+
"websockets>=10.0",
|
|
34
|
+
"cryptography>=3.4.8",
|
|
35
|
+
]
|
|
36
|
+
|
|
37
|
+
[project.optional-dependencies]
|
|
38
|
+
dev = [
|
|
39
|
+
"pytest>=7.0.0",
|
|
40
|
+
"pytest-asyncio>=0.21.0",
|
|
41
|
+
"pytest-cov>=4.0.0",
|
|
42
|
+
"black>=22.0.0",
|
|
43
|
+
"isort>=5.10.0",
|
|
44
|
+
"flake8>=4.0.0",
|
|
45
|
+
"mypy>=0.910",
|
|
46
|
+
"pre-commit>=2.15.0",
|
|
47
|
+
]
|
|
48
|
+
docs = [
|
|
49
|
+
"sphinx>=4.0.0",
|
|
50
|
+
"sphinx-rtd-theme>=1.0.0",
|
|
51
|
+
"myst-parser>=0.15.0",
|
|
52
|
+
]
|
|
53
|
+
|
|
54
|
+
[project.urls]
|
|
55
|
+
Homepage = "https://codestats.gg"
|
|
56
|
+
Documentation = "https://brokechubb.github.io/StakeAPI/"
|
|
57
|
+
Repository = "https://github.com/brokechubb/StakeAPI"
|
|
58
|
+
"Bug Tracker" = "https://github.com/brokechubb/StakeAPI/issues"
|
|
59
|
+
|
|
60
|
+
[tool.setuptools.packages.find]
|
|
61
|
+
include = ["stakeapi*"]
|
|
62
|
+
|
|
63
|
+
[tool.black]
|
|
64
|
+
line-length = 88
|
|
65
|
+
target-version = ['py38']
|
|
66
|
+
include = '\.pyi?$'
|
|
67
|
+
extend-exclude = '''
|
|
68
|
+
/(
|
|
69
|
+
# directories
|
|
70
|
+
\.eggs
|
|
71
|
+
| \.git
|
|
72
|
+
| \.hg
|
|
73
|
+
| \.mypy_cache
|
|
74
|
+
| \.tox
|
|
75
|
+
| \.venv
|
|
76
|
+
| build
|
|
77
|
+
| dist
|
|
78
|
+
)/
|
|
79
|
+
'''
|
|
80
|
+
|
|
81
|
+
[tool.isort]
|
|
82
|
+
profile = "black"
|
|
83
|
+
multi_line_output = 3
|
|
84
|
+
line_length = 88
|
|
85
|
+
known_first_party = ["stakeapi"]
|
|
86
|
+
|
|
87
|
+
[tool.mypy]
|
|
88
|
+
python_version = "3.8"
|
|
89
|
+
warn_return_any = true
|
|
90
|
+
warn_unused_configs = true
|
|
91
|
+
disallow_untyped_defs = true
|
|
92
|
+
disallow_incomplete_defs = true
|
|
93
|
+
check_untyped_defs = true
|
|
94
|
+
disallow_untyped_decorators = true
|
|
95
|
+
no_implicit_optional = true
|
|
96
|
+
warn_redundant_casts = true
|
|
97
|
+
warn_unused_ignores = true
|
|
98
|
+
warn_no_return = true
|
|
99
|
+
warn_unreachable = true
|
|
100
|
+
strict_equality = true
|
|
101
|
+
|
|
102
|
+
[tool.pytest.ini_options]
|
|
103
|
+
testpaths = ["tests"]
|
|
104
|
+
asyncio_mode = "auto"
|
|
105
|
+
addopts = "--cov=stakeapi --cov-report=term-missing --cov-report=html"
|
|
106
|
+
|
|
107
|
+
[tool.coverage.run]
|
|
108
|
+
source = ["stakeapi"]
|
|
109
|
+
omit = ["*/tests/*", "*/__pycache__/*"]
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"""
|
|
2
|
+
StakeAPI - Unofficial Python API wrapper for stake.com
|
|
3
|
+
|
|
4
|
+
This package provides a comprehensive interface to interact with stake.com's
|
|
5
|
+
GraphQL API programmatically.
|
|
6
|
+
|
|
7
|
+
Example usage:
|
|
8
|
+
import asyncio
|
|
9
|
+
from stakeapi import StakeAPI
|
|
10
|
+
|
|
11
|
+
async def main():
|
|
12
|
+
async with StakeAPI(access_token="your_token") as client:
|
|
13
|
+
balance = await client.get_user_balance()
|
|
14
|
+
print(balance)
|
|
15
|
+
|
|
16
|
+
asyncio.run(main())
|
|
17
|
+
"""
|
|
18
|
+
|
|
19
|
+
from ._version import __version__
|
|
20
|
+
from .auth import AuthManager
|
|
21
|
+
from .client import StakeAPI
|
|
22
|
+
from .exceptions import AuthenticationError, RateLimitError, StakeAPIError
|
|
23
|
+
|
|
24
|
+
__all__ = [
|
|
25
|
+
"StakeAPI",
|
|
26
|
+
"AuthManager",
|
|
27
|
+
"StakeAPIError",
|
|
28
|
+
"AuthenticationError",
|
|
29
|
+
"RateLimitError",
|
|
30
|
+
"__version__",
|
|
31
|
+
]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.1.0"
|