infinitode.py 1.1.2__tar.gz → 1.1.4__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.
@@ -0,0 +1,228 @@
1
+ Metadata-Version: 2.1
2
+ Name: infinitode.py
3
+ Version: 1.1.4
4
+ Summary: A python wrapper for the Infinitode 2 API.
5
+ Home-page: https://github.com/Sprylos/infinitode.py
6
+ Author: Sprylos
7
+ License: MIT
8
+ Platform: UNKNOWN
9
+ Description-Content-Type: text/markdown
10
+
11
+ # Infinitode.py
12
+
13
+ An asynchronous Python wrapper for the Infinitode-2 API using `async`-`await` syntax.
14
+
15
+ ---
16
+
17
+ ## Installation
18
+
19
+ Install the library via pip:
20
+
21
+ ```bash
22
+ pip install infinitode.py
23
+ ```
24
+
25
+ ---
26
+
27
+ ## Showcase
28
+
29
+ ### Setting Up a Session
30
+
31
+ Create a session to communicate with Rainy's API. Use the `with` statement to ensure the session closes properly.
32
+ Alternatively you can can simply call `Session.close()` once you don't need it anymore.
33
+
34
+ ```python
35
+ import asyncio
36
+ import infinitode
37
+
38
+ async def main():
39
+ async with infinitode.Session() as API:
40
+ # Your API calls go here
41
+ pass
42
+
43
+ asyncio.run(main())
44
+ ```
45
+
46
+ ---
47
+
48
+ ### Fetching Leaderboard Data
49
+
50
+ Parameters:
51
+ - `mapname`: The map identifier (e.g., "5.1" or "4.b1" or "zecred").
52
+ - `playerid` (sometimes optional): The player's unique identifier.
53
+ - `mode` (optional): One of `'score'`, `'waves'`. Defaults to `'score'`.
54
+ - `difficulty` (optional): One of `'EASY'`, `'NORMAL'`, `'ENDLESS_I'`. Defaults to `'NORMAL'`.
55
+
56
+ #### Player Score on a Specific Map
57
+
58
+ Retrieve the score of a specific player on a particular map.
59
+
60
+ ```python
61
+ score_5_1 = await API.leaderboards_rank(
62
+ mapname="5.1",
63
+ playerid="U-E9BP-FSN9-H6ENMQ",
64
+ mode="score",
65
+ difficulty="NORMAL"
66
+ )
67
+ ```
68
+
69
+ #### Top 200 Leaderboard on a Specific Map
70
+
71
+ Retrieve the leaderboard of the top 200 wave scores on 5.1.
72
+
73
+ ```python
74
+ leaderboard_5_1 = await API.leaderboards(
75
+ mapname=5.1,
76
+ mode="waves"
77
+ )
78
+ ```
79
+
80
+ #### Runtime Leaderboard
81
+
82
+ Fetch the leaderboard displayed during gameplay. This provides additional percentile information.
83
+
84
+ ```python
85
+ runtime_5_1 = await API.runtime_leaderboards(
86
+ mapname=5.1,
87
+ playerid="U-E9BP-FSN9-H6ENMQ",
88
+ difficulty="ENDLESS_I"
89
+ )
90
+ ```
91
+
92
+ ---
93
+
94
+ #### Skill Point Leaderboard
95
+
96
+ Get the top 3 skill point owners. Optionally specify a `playerid`.
97
+
98
+ ```python
99
+ sp_leaderboard = await API.skill_point_leaderboard(
100
+ playerid="U-E9BP-FSN9-H6ENMQ"
101
+ )
102
+ ```
103
+
104
+
105
+ #### Daily Quest Leaderboard
106
+
107
+ Retrieve the top 200 players of today's daily quest or a specified date.
108
+
109
+ - `date`: `YYYY-MM-DD` (string) or `datetime.datetime`.
110
+
111
+ ```python
112
+ dq_leaderboard = await API.daily_quest_leaderboards("2024-12-05")
113
+ ```
114
+
115
+ ---
116
+
117
+ ### Working with Leaderboards
118
+
119
+ A leaderboard is a sequence of scores with additional utility functions.
120
+
121
+ #### Access Score and Leaderboard Attributes
122
+
123
+ Leaderboards always have these attributes:
124
+ - `mapname`, `mode`, `difficulty`, `total`
125
+
126
+ And optionally these:
127
+ - `date`, `season`, `player` (will return a score object)
128
+
129
+ Scores always have these attributes:
130
+ - `playerid`, `rank`, `score`, `mapname`, `mode`, `difficulty`
131
+
132
+ And optionally these:
133
+ - `has_pfp`, `level`, `nickname`, `pinned_badge`, `position`, `top`, `total`, `player` (will return a Player object if fetched beforehand)
134
+
135
+ #### Example for printing attributes, scores, and leaderboards
136
+
137
+ ```python
138
+ for score in leaderboard_5_1:
139
+ print(score.nickname)
140
+ score.print_score() # Helper method
141
+
142
+ leaderboard_5_1.print_scores()
143
+ ```
144
+
145
+ #### Slice a Leaderboard
146
+
147
+ Retrieve a subset of the leaderboard:
148
+
149
+ ```python
150
+ top_1 = leaderboard_5_1[0]
151
+ top_10 = leaderboard_5_1[0:10]
152
+ print(len(top_10))
153
+ ```
154
+
155
+ ---
156
+
157
+ ### Player Information
158
+
159
+ #### Fetch Player Data
160
+
161
+ Retrieve detailed player information.
162
+
163
+ ```python
164
+ player = await API.player("U-E9BP-FSN9-H6ENMQ")
165
+ ```
166
+
167
+ Attributes include:
168
+ - `playerid`, `nickname`, `level`, `xp`, `season_level`, `total_score`, and many more.
169
+
170
+ #### Get Player Scores
171
+
172
+ Use the `score` method to access specific map scores.
173
+
174
+ ```python
175
+ player.score(5.1).print_score()
176
+ ```
177
+
178
+ #### Fetch Daily Quest and Skill Point Scores
179
+
180
+ Use additional API calls to retrieve daily quest and skill point scores:
181
+
182
+ ```python
183
+ await player.fetch_daily_quest(API)
184
+ await player.fetch_skill_point(API)
185
+
186
+ print(player.daily_quest.rank, player.skill_point.score)
187
+ ```
188
+
189
+ ---
190
+
191
+ ### Beta Scores
192
+
193
+ Almost all API calls support an additional `beta` boolean parameter. This will make a request to the beta servers instead. No guarantees for it working.
194
+
195
+ ```python
196
+ leaderboard_5_1 = await API.leaderboards(mapname=5.1, mode='waves', beta=True)
197
+ ```
198
+
199
+
200
+ ### Logging
201
+
202
+ Set up logging to monitor requests and responses.
203
+
204
+ - `INFO`: Logs every request.
205
+ - `DEBUG`: Logs server responses.
206
+
207
+ ```python
208
+ import infinitode
209
+ import asyncio
210
+ import logging
211
+
212
+ logging.basicConfig(level=logging.INFO)
213
+
214
+ async def main():
215
+ async with infinitode.Session() as API:
216
+ await API.leaderboards("6.3")
217
+
218
+ asyncio.run(main())
219
+ ```
220
+
221
+ ---
222
+
223
+ ### Notes
224
+
225
+ - Some data (e.g., seasonal leaderboard, players) require additional parsing and will take longer to process.
226
+ - Do not abuse this API wrapper for any kind of malicious action.
227
+
228
+
@@ -0,0 +1,216 @@
1
+ # Infinitode.py
2
+
3
+ An asynchronous Python wrapper for the Infinitode-2 API using `async`-`await` syntax.
4
+
5
+ ---
6
+
7
+ ## Installation
8
+
9
+ Install the library via pip:
10
+
11
+ ```bash
12
+ pip install infinitode.py
13
+ ```
14
+
15
+ ---
16
+
17
+ ## Showcase
18
+
19
+ ### Setting Up a Session
20
+
21
+ Create a session to communicate with Rainy's API. Use the `with` statement to ensure the session closes properly.
22
+ Alternatively you can can simply call `Session.close()` once you don't need it anymore.
23
+
24
+ ```python
25
+ import asyncio
26
+ import infinitode
27
+
28
+ async def main():
29
+ async with infinitode.Session() as API:
30
+ # Your API calls go here
31
+ pass
32
+
33
+ asyncio.run(main())
34
+ ```
35
+
36
+ ---
37
+
38
+ ### Fetching Leaderboard Data
39
+
40
+ Parameters:
41
+ - `mapname`: The map identifier (e.g., "5.1" or "4.b1" or "zecred").
42
+ - `playerid` (sometimes optional): The player's unique identifier.
43
+ - `mode` (optional): One of `'score'`, `'waves'`. Defaults to `'score'`.
44
+ - `difficulty` (optional): One of `'EASY'`, `'NORMAL'`, `'ENDLESS_I'`. Defaults to `'NORMAL'`.
45
+
46
+ #### Player Score on a Specific Map
47
+
48
+ Retrieve the score of a specific player on a particular map.
49
+
50
+ ```python
51
+ score_5_1 = await API.leaderboards_rank(
52
+ mapname="5.1",
53
+ playerid="U-E9BP-FSN9-H6ENMQ",
54
+ mode="score",
55
+ difficulty="NORMAL"
56
+ )
57
+ ```
58
+
59
+ #### Top 200 Leaderboard on a Specific Map
60
+
61
+ Retrieve the leaderboard of the top 200 wave scores on 5.1.
62
+
63
+ ```python
64
+ leaderboard_5_1 = await API.leaderboards(
65
+ mapname=5.1,
66
+ mode="waves"
67
+ )
68
+ ```
69
+
70
+ #### Runtime Leaderboard
71
+
72
+ Fetch the leaderboard displayed during gameplay. This provides additional percentile information.
73
+
74
+ ```python
75
+ runtime_5_1 = await API.runtime_leaderboards(
76
+ mapname=5.1,
77
+ playerid="U-E9BP-FSN9-H6ENMQ",
78
+ difficulty="ENDLESS_I"
79
+ )
80
+ ```
81
+
82
+ ---
83
+
84
+ #### Skill Point Leaderboard
85
+
86
+ Get the top 3 skill point owners. Optionally specify a `playerid`.
87
+
88
+ ```python
89
+ sp_leaderboard = await API.skill_point_leaderboard(
90
+ playerid="U-E9BP-FSN9-H6ENMQ"
91
+ )
92
+ ```
93
+
94
+
95
+ #### Daily Quest Leaderboard
96
+
97
+ Retrieve the top 200 players of today's daily quest or a specified date.
98
+
99
+ - `date`: `YYYY-MM-DD` (string) or `datetime.datetime`.
100
+
101
+ ```python
102
+ dq_leaderboard = await API.daily_quest_leaderboards("2024-12-05")
103
+ ```
104
+
105
+ ---
106
+
107
+ ### Working with Leaderboards
108
+
109
+ A leaderboard is a sequence of scores with additional utility functions.
110
+
111
+ #### Access Score and Leaderboard Attributes
112
+
113
+ Leaderboards always have these attributes:
114
+ - `mapname`, `mode`, `difficulty`, `total`
115
+
116
+ And optionally these:
117
+ - `date`, `season`, `player` (will return a score object)
118
+
119
+ Scores always have these attributes:
120
+ - `playerid`, `rank`, `score`, `mapname`, `mode`, `difficulty`
121
+
122
+ And optionally these:
123
+ - `has_pfp`, `level`, `nickname`, `pinned_badge`, `position`, `top`, `total`, `player` (will return a Player object if fetched beforehand)
124
+
125
+ #### Example for printing attributes, scores, and leaderboards
126
+
127
+ ```python
128
+ for score in leaderboard_5_1:
129
+ print(score.nickname)
130
+ score.print_score() # Helper method
131
+
132
+ leaderboard_5_1.print_scores()
133
+ ```
134
+
135
+ #### Slice a Leaderboard
136
+
137
+ Retrieve a subset of the leaderboard:
138
+
139
+ ```python
140
+ top_1 = leaderboard_5_1[0]
141
+ top_10 = leaderboard_5_1[0:10]
142
+ print(len(top_10))
143
+ ```
144
+
145
+ ---
146
+
147
+ ### Player Information
148
+
149
+ #### Fetch Player Data
150
+
151
+ Retrieve detailed player information.
152
+
153
+ ```python
154
+ player = await API.player("U-E9BP-FSN9-H6ENMQ")
155
+ ```
156
+
157
+ Attributes include:
158
+ - `playerid`, `nickname`, `level`, `xp`, `season_level`, `total_score`, and many more.
159
+
160
+ #### Get Player Scores
161
+
162
+ Use the `score` method to access specific map scores.
163
+
164
+ ```python
165
+ player.score(5.1).print_score()
166
+ ```
167
+
168
+ #### Fetch Daily Quest and Skill Point Scores
169
+
170
+ Use additional API calls to retrieve daily quest and skill point scores:
171
+
172
+ ```python
173
+ await player.fetch_daily_quest(API)
174
+ await player.fetch_skill_point(API)
175
+
176
+ print(player.daily_quest.rank, player.skill_point.score)
177
+ ```
178
+
179
+ ---
180
+
181
+ ### Beta Scores
182
+
183
+ Almost all API calls support an additional `beta` boolean parameter. This will make a request to the beta servers instead. No guarantees for it working.
184
+
185
+ ```python
186
+ leaderboard_5_1 = await API.leaderboards(mapname=5.1, mode='waves', beta=True)
187
+ ```
188
+
189
+
190
+ ### Logging
191
+
192
+ Set up logging to monitor requests and responses.
193
+
194
+ - `INFO`: Logs every request.
195
+ - `DEBUG`: Logs server responses.
196
+
197
+ ```python
198
+ import infinitode
199
+ import asyncio
200
+ import logging
201
+
202
+ logging.basicConfig(level=logging.INFO)
203
+
204
+ async def main():
205
+ async with infinitode.Session() as API:
206
+ await API.leaderboards("6.3")
207
+
208
+ asyncio.run(main())
209
+ ```
210
+
211
+ ---
212
+
213
+ ### Notes
214
+
215
+ - Some data (e.g., seasonal leaderboard, players) require additional parsing and will take longer to process.
216
+ - Do not abuse this API wrapper for any kind of malicious action.
@@ -7,10 +7,10 @@ An asynchronous wrapper for the Infinitode API.
7
7
 
8
8
  __author__ = "Sprylos"
9
9
  __title__ = "infinitode.py"
10
- __version__ = "1.1.2"
10
+ __version__ = "1.1.4"
11
11
  __license__ = """MIT License
12
12
 
13
- Copyright (c) 2024 Sprylos
13
+ Copyright (c) 2025 Sprylos
14
14
 
15
15
  Permission is hereby granted, free of charge, to any person obtaining a copy
16
16
  of this software and associated documentation files (the "Software"), to deal