akef 0.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.
@@ -0,0 +1,289 @@
1
+ Metadata-Version: 2.4
2
+ Name: akef
3
+ Version: 0.3.0
4
+ Summary: Async Python wrapper for Arknights: Endfield, SKPORT accounts, Enka profiles and final stats
5
+ Author-email: SORA <shresthvaibhav13@gmail.com>
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/ShresthVaibhav/akef
8
+ Project-URL: Documentation, https://github.com/ShresthVaibhav/akef/tree/main/docs
9
+ Project-URL: Issues, https://github.com/ShresthVaibhav/akef/issues
10
+ Keywords: arknights,endfield,skport,enka,gryphline,api,async
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Framework :: AsyncIO
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Operating System :: OS Independent
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Programming Language :: Python :: 3.13
20
+ Classifier: Topic :: Games/Entertainment
21
+ Classifier: Typing :: Typed
22
+ Requires-Python: >=3.10
23
+ Description-Content-Type: text/markdown
24
+ License-File: LICENSE
25
+ Requires-Dist: aiohttp>=3.9
26
+ Requires-Dist: pydantic>=2.5
27
+ Provides-Extra: dev
28
+ Requires-Dist: pytest>=8; extra == "dev"
29
+ Requires-Dist: pytest-asyncio>=0.23; extra == "dev"
30
+ Dynamic: license-file
31
+
32
+ # akef
33
+
34
+ Async Python wrapper for Arknights: Endfield. Your SKPORT account card, operators with gear, pull history,
35
+ endgame records, daily check-in and the wiki. Also public Enka profiles by UID, and final stats like the ones
36
+ on the in-game stat screen for any operator.
37
+
38
+ ## Install
39
+
40
+ ```
41
+ pip install akef
42
+ ```
43
+
44
+ Python 3.10+. Full docs in [`docs/`](https://github.com/ShresthVaibhav/akef/blob/main/docs/README.md), a script for every feature in
45
+ [`examples/`](https://github.com/ShresthVaibhav/akef/tree/main/examples).
46
+
47
+ ## Usage
48
+
49
+ ```py
50
+ import asyncio
51
+ import akef
52
+
53
+
54
+ async def main():
55
+ async with akef.Client("your account token") as client:
56
+ card = await client.card()
57
+ print(card.name, card.base.level, card.base.world_level)
58
+ print(f"sanity {card.stamina.current}/{card.stamina.max}")
59
+
60
+ for op in card.chars:
61
+ print(op.rarity, op.name, op.level, op.weapon.name)
62
+
63
+
64
+ asyncio.run(main())
65
+ ```
66
+
67
+ Login, request signing and logging back in when the session runs out, all handled for you.
68
+
69
+ ## Methods
70
+
71
+ Everything comes back as a pydantic model. Fields SKPORT adds later still show up in `model_extra`. Pass
72
+ `raw=True` to any of them to get the plain API dict instead.
73
+
74
+ | Method | Gives you |
75
+ | --- | --- |
76
+ | `card(uid=None)` | profile, operators with gear, sanity, dailies, battle pass, regions, dijiang, contracts, war echoes |
77
+ | `character(who, uid=None)` | one operator or a list, by name (any case or spacing) or SKPORT id |
78
+ | `monument(uid=None)` | endgame events: stages, rules, enemies, best clear team and time, medals |
79
+ | `contract(uid=None)` | current Contingency Contract: every run with its team, all indicators with their effect text, enemies |
80
+ | `pulls(uid=None, after=None, since=None)` | whole pull history with pity per banner |
81
+ | `inventory(uid=None)` | every owned operator, weapon, gear piece and tactical, with counts |
82
+ | `attendance(uid=None)` | this month's check-in calendar and rewards |
83
+ | `check_in(uid=None)` | claims today's check-in, raises `AlreadyCheckedIn` if its done |
84
+ | `news()` | the in-game notice board |
85
+ | `wiki(kind)` / `wiki_item(id)` | SKPORT's official database |
86
+ | `wiki_index()` | every wiki item by id, for naming the materials a page links to |
87
+ | `char_banners()` / `weapon_banners()` | current banners |
88
+ | `roles()` / `role(uid=None)` | Endfield accounts on the login |
89
+ | `enums()` | game enums: professions, elements, rarities... |
90
+ | `profile()` | SKPORT user profile |
91
+ | `account()` | Gryphline account info |
92
+
93
+ `uid=None` means the default account on the login.
94
+
95
+ <details>
96
+ <summary>Housekeeping</summary>
97
+
98
+ | Method | |
99
+ | --- | --- |
100
+ | `login()` | log in now instead of on the first request |
101
+ | `refresh()` | get a new signing key, akef does this by itself when it goes stale |
102
+ | `clear_cache()` | forget cached reads |
103
+ | `close()` | close the session, or just use `async with` |
104
+ </details>
105
+
106
+ <details>
107
+ <summary>Wiki kinds and readable pages</summary>
108
+
109
+ `operators`, `weapons`, `threats`, `gear`, `facilities`, `items`, `essence`, `valuables`
110
+
111
+ ```py
112
+ ops = await client.wiki("operators")
113
+ arcane = await client.wiki_item(next(o for o in ops if o.name == "Arcane").id)
114
+ print(arcane.description)
115
+
116
+ page = akef.wiki_page(arcane, await client.wiki_index()) # quote, bio, skills, talents, lore...
117
+ print(page.quote, [s.name for s in page.skills])
118
+ ```
119
+
120
+ The raw page is a deep tree of blocks, `wiki_page()` turns it into plain fields so you dont dig through it.
121
+ </details>
122
+
123
+ ## Enka and final stats
124
+
125
+ SKPORT only says what an operator has equipped, not the numbers on their stat screen. `akef.Enka` works them
126
+ out same way enka.network does, from Enka's public game data. We checked them against the site and the game,
127
+ they match.
128
+
129
+ ```py
130
+ async with akef.Enka() as enka:
131
+ profile = await enka.profile(4727743200) # any public UID, no token needed
132
+ si = profile.build("Si")
133
+ print(si.stats.hp, si.stats.atk, si.stats.crit_rate)
134
+ ```
135
+
136
+ Enka only sees the 4 operators in the showcase. With a SKPORT card you get anyone on the account:
137
+
138
+ ```py
139
+ async with akef.Client(token) as client, akef.Enka() as enka:
140
+ card = await client.card()
141
+ build = await enka.build(card, "Arcane")
142
+ print(build.stats.atk, build.gear[0].lines)
143
+ ```
144
+
145
+ | Method | Gives you |
146
+ | --- | --- |
147
+ | `profile(uid)` | showcased operators with final stats, plus the player's profile |
148
+ | `build(card, name)` | final stats for any operator on a SKPORT card |
149
+ | `player(card)` | the whole roster as a profile |
150
+ | `update()` | pull new game tables after a patch |
151
+ | `clear_cache()` | forget cached Enka answers |
152
+
153
+ First call downloads Enka's game tables (few MB) and keeps them on disk. After a patch they refresh by
154
+ themselves when something new shows up. More in [docs/enka.md](https://github.com/ShresthVaibhav/akef/blob/main/docs/enka.md), and how the numbers got
155
+ checked in [docs/stats.md](https://github.com/ShresthVaibhav/akef/blob/main/docs/stats.md).
156
+
157
+ ## Pull history
158
+
159
+ ```py
160
+ pulls = await client.pulls()
161
+ for p in pulls.pity():
162
+ print(p.name, f"{p.since_six}/{p.hard}")
163
+
164
+ pulls.save("pulls.json") # or pulls.csv
165
+ old = akef.Pulls.load("pulls.json")
166
+ newer = await client.pulls(since=old) # only fetches whats new and merges it in
167
+ recent = await client.pulls(after=date(2026, 11, 1))
168
+ ```
169
+
170
+ SKPORT hands out pulls 5 a page, so first full grab of a big account takes a while. Save it and pass `since=`
171
+ next time. Passing another UID's saved pulls raises a `ValueError`, so two accounts never get mixed.
172
+
173
+ `pulls.operators`, `pulls.weapons` and `pulls.gifts` hold the pulls. `pulls.banner("standard")` and
174
+ `pulls.weapon_banner(pool_id)` filter one banner, `pulls.to_csv()` and `pulls.to_json()` give the text without
175
+ saving.
176
+
177
+ <details>
178
+ <summary>How pity is counted</summary>
179
+
180
+ | Banner | Hard pity | Featured |
181
+ | --- | --- | --- |
182
+ | Limited operators | 80, shared across limited banners | 120, per banner |
183
+ | Standard | 80 | 300 |
184
+ | Beginner | 50 | |
185
+ | Weapons | 40 | 80 |
186
+
187
+ Free urgent recruitment pulls dont move pity.
188
+ </details>
189
+
190
+ ## Getting a token
191
+
192
+ While signed in to [skport.com](https://www.skport.com), open
193
+ `https://web-api.skport.com/cookie_store/account_token`. You get back something like
194
+ `{"code":0,"data":{"content":"..."}}`, the `content` string is your token.
195
+
196
+ That token is a full login for your account, dont share it with anyone.
197
+
198
+ ## Caching and logins
199
+
200
+ Reads stay in memory for a short while, so a bot where ten people check the same account sends one request, not
201
+ ten. If the same request is already on its way, other callers wait for it instead of sending their own.
202
+
203
+ | What | Kept for |
204
+ | --- | --- |
205
+ | `card()`, `character()`, `attendance()`, `inventory()` | 1 minute |
206
+ | `monument()`, `contract()`, `profile()` | 5 minutes |
207
+ | `Enka.profile()` | as long as Enka's own ttl says, about a minute |
208
+ | banners | 10 minutes |
209
+ | `enums()`, wiki | 1 hour |
210
+
211
+ Errors are never cached and `check_in()` clears the cached calendar.
212
+
213
+ ```py
214
+ client = akef.Client(token, cache=False) # no cache
215
+ client.clear_cache() # fresh data next call
216
+ client = akef.Client(token, login_file="skport_login.json") # keep the login between runs
217
+ client = akef.Client(token, debug=True) # log every request
218
+ ```
219
+
220
+ Every new `Client` logs in first, thats two requests. With `login_file` it saves the login and your account list,
221
+ so a restart only pays for what you ask. If SKPORT expires it, akef logs in again by itself and updates the file.
222
+ Keep that file private, it works like the token. Debug logs only show the path, never tokens or query strings.
223
+
224
+ ## Errors
225
+
226
+ ```py
227
+ try:
228
+ card = await client.card()
229
+ except akef.AuthError:
230
+ ... # token is dead, get a new one
231
+ except akef.NoRoleError:
232
+ ... # no Endfield account on this login
233
+ except akef.AkefError as e:
234
+ print(e.code, e.message)
235
+ ```
236
+
237
+ <details>
238
+ <summary>All errors</summary>
239
+
240
+ | Error | When |
241
+ | --- | --- |
242
+ | `AkefError` | base of all of them, has `.code` and `.message` |
243
+ | `AuthError` | token rejected or expired |
244
+ | `NoRoleError` | no Endfield account bound to the login |
245
+ | `NetworkError` | couldnt reach SKPORT or Enka |
246
+ | `APIError` | SKPORT said no for some other reason |
247
+ | `AlreadyCheckedIn` | `check_in()` when today is already claimed |
248
+ | `UnknownCharacter` | `character()` or `Enka.build()` with a name that doesnt match anyone |
249
+ | `PlayerNotFound` | Enka doesnt know the UID |
250
+ | `ShowcaseEmpty` | Enka player has nothing in their showcase |
251
+ | `MissingGameData` | something from a new patch isnt in Enka's data yet |
252
+ | `GameDataError` | saved game tables are broken, `await enka.update()` |
253
+ </details>
254
+
255
+ ## Examples
256
+
257
+ | Script | Shows |
258
+ | --- | --- |
259
+ | [`card.py`](https://github.com/ShresthVaibhav/akef/blob/main/examples/card.py) | the basics off your account card |
260
+ | [`operators.py`](https://github.com/ShresthVaibhav/akef/blob/main/examples/operators.py) | every operator with skills, weapon and gear |
261
+ | [`character.py`](https://github.com/ShresthVaibhav/akef/blob/main/examples/character.py) | look up operators by name |
262
+ | [`pulls.py`](https://github.com/ShresthVaibhav/akef/blob/main/examples/pulls.py) | pull history, pity, save, load, csv |
263
+ | [`monument.py`](https://github.com/ShresthVaibhav/akef/blob/main/examples/monument.py) | monument events and clear teams |
264
+ | [`contract.py`](https://github.com/ShresthVaibhav/akef/blob/main/examples/contract.py) | contract runs, teams and indicators |
265
+ | [`endgame.py`](https://github.com/ShresthVaibhav/akef/blob/main/examples/endgame.py) | contracts and war echoes off the card |
266
+ | [`inventory.py`](https://github.com/ShresthVaibhav/akef/blob/main/examples/inventory.py) | everything you own |
267
+ | [`attendance.py`](https://github.com/ShresthVaibhav/akef/blob/main/examples/attendance.py), [`check_in.py`](https://github.com/ShresthVaibhav/akef/blob/main/examples/check_in.py) | daily check-in |
268
+ | [`banners.py`](https://github.com/ShresthVaibhav/akef/blob/main/examples/banners.py) | current banners |
269
+ | [`news.py`](https://github.com/ShresthVaibhav/akef/blob/main/examples/news.py) | notice board |
270
+ | [`wiki.py`](https://github.com/ShresthVaibhav/akef/blob/main/examples/wiki.py) | the official wiki, and pages made readable |
271
+ | [`enka.py`](https://github.com/ShresthVaibhav/akef/blob/main/examples/enka.py) | a public profile by UID with final stats |
272
+ | [`final_stats.py`](https://github.com/ShresthVaibhav/akef/blob/main/examples/final_stats.py) | final stats and gear lines for your whole roster |
273
+ | [`world.py`](https://github.com/ShresthVaibhav/akef/blob/main/examples/world.py) | regions and dijiang |
274
+ | [`caching.py`](https://github.com/ShresthVaibhav/akef/blob/main/examples/caching.py) | cache, login file and debug logs |
275
+ | [`errors.py`](https://github.com/ShresthVaibhav/akef/blob/main/examples/errors.py) | catching errors |
276
+ | [`raw.py`](https://github.com/ShresthVaibhav/akef/blob/main/examples/raw.py) | plain API dicts |
277
+ | [`roles.py`](https://github.com/ShresthVaibhav/akef/blob/main/examples/roles.py), [`account.py`](https://github.com/ShresthVaibhav/akef/blob/main/examples/account.py), [`profile.py`](https://github.com/ShresthVaibhav/akef/blob/main/examples/profile.py), [`enums.py`](https://github.com/ShresthVaibhav/akef/blob/main/examples/enums.py) | account side stuff |
278
+
279
+ They read the token from `SKPORT_TOKEN` or `~/.skport_token`, except `enka.py` which only needs a UID.
280
+
281
+ ## Image cards
282
+
283
+ Want all this as pictures? [akef-cards](https://github.com/ShresthVaibhav/akef-cards) draws it: operator builds,
284
+ profiles, pull history, endgame and more. akef gets the data, akef-cards only draws.
285
+
286
+ ## License
287
+
288
+ MIT. Game data for the stat math comes from [Enka.Network](https://enka.network), thanks enka.
289
+ Not affiliated with Hypergryph or Gryphline.
@@ -0,0 +1,28 @@
1
+ akef/__init__.py,sha256=GMNlBpwpPVUSzek_jlZNz9OyJ4f2MdqQ20faUv_JW0g,431
2
+ akef/cache.py,sha256=oalrkDEzFhvAdtr0TpiGnsTgdbVBlQ7SYKm7vhcdwMo,1241
3
+ akef/client.py,sha256=MsGYPFwSbEKhv6ICaoIZGFXukWR8dVwuHq9yDXgDhEY,25592
4
+ akef/constants.py,sha256=UDMDKQ9BIKS3NkB0-KYiy93LsxS_JI5PHy8MSSUpIMg,577
5
+ akef/errors.py,sha256=OGI4uiTEaZfhanH647wFK6IB2HrrSbu1AcdsFmt1DR8,985
6
+ akef/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
+ akef/signing.py,sha256=IyWk2ZZ4TNjYbdyqHKWlDJu2RlvQoJ15kZ9uv2Tf0Lo,684
8
+ akef/wiki.py,sha256=aACZo7_KAPAACL8D2HrCm7G2SHIRxbs7XlCYT2qmdOs,6533
9
+ akef/enka/__init__.py,sha256=r1XllZlK1axqwoU1EH8_HhHPQeBw36B31dqw72VDLXs,674
10
+ akef/enka/build.py,sha256=rqnd6lrgNOUsqSdxXcGSGPdmOuRiA23yer9_pJHl0Kc,4181
11
+ akef/enka/client.py,sha256=XomeTCOn1V4lTqcDU5UAeer-bk1kiWHCZHhHSms8Glk,2124
12
+ akef/enka/gamedata.py,sha256=km5IHiS580XGBnfjU6t1Lb_xpd5ttampMBBoVhqYCbE,8041
13
+ akef/enka/player.py,sha256=k7L1LEe3auhgLNWWJLY458m5oCmMKhf5mLAQSbcaZnc,1479
14
+ akef/enka/profile.py,sha256=8iIaDRjcF4sYBwI_GBLd755R5IvrvO24MzzcxT_XSsE,14201
15
+ akef/enka/skport.py,sha256=huMwHRPe_YGI7lNx0b4Rw2TEpxrpjQHjqEqUqLCWcXQ,9962
16
+ akef/enka/stats.py,sha256=QcZ8NrRJXG405MFhlD5dJt_S32s1oDPEMEIJvS_gZ4I,11287
17
+ akef/models/__init__.py,sha256=JJDMUXX4DLiTCzkS_0vBzDXq7jPI3-sx50SFBYiWa9A,1982
18
+ akef/models/account.py,sha256=UgS5bVL9jb4Vt7VyvFWqpYUC76fKEukKiqzBAWJn2ms,1501
19
+ akef/models/base.py,sha256=uPkib0noFqNjyBdxZPdCDGcOrowZ8rqPuf9SIbByRcg,969
20
+ akef/models/card.py,sha256=yfhbxGSqYUEHFDKB5y1QEbbSMyZoww7fxJhYilz41BQ,18094
21
+ akef/models/extra.py,sha256=DqgJ3IF3H-M2FyauOb1TXq0CHkrkmgUxEzhHAobQrV8,6996
22
+ akef/models/game.py,sha256=3fg6FoIRbG5GmuAUcJuCYo6_xT1k91J_GN36wTOJ0xw,2989
23
+ akef/models/pulls.py,sha256=xPXK0YWhhbJ6R4WoZIognE_L1gSwNueiIYK9nr3AipA,5619
24
+ akef-0.3.0.dist-info/licenses/LICENSE,sha256=Aha7QFmjGKZdy2dGcOhS1sR3r3S0cfPo145pKknSTsQ,1072
25
+ akef-0.3.0.dist-info/METADATA,sha256=lKH8CUG9EBnvTXntMH2zDwM5CJRjKGgQX2Wvpe4SGLk,13281
26
+ akef-0.3.0.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
27
+ akef-0.3.0.dist-info/top_level.txt,sha256=fxx13NoipnUZ8_d_eJHbdTAb7_WEDk38NHnuplLU_Nw,5
28
+ akef-0.3.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (84.2.1)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Vaibhav Shresth
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 @@
1
+ akef