infinitode.py 1.1.2__tar.gz → 1.1.3__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.
- infinitode.py-1.1.3/PKG-INFO +228 -0
- infinitode.py-1.1.3/README.md +216 -0
- {infinitode.py-1.1.2 → infinitode.py-1.1.3}/infinitode/__init__.py +1 -1
- {infinitode.py-1.1.2 → infinitode.py-1.1.3}/infinitode/leaderboard.py +1 -1
- infinitode.py-1.1.3/infinitode.py.egg-info/PKG-INFO +228 -0
- infinitode.py-1.1.2/PKG-INFO +0 -164
- infinitode.py-1.1.2/README.md +0 -152
- infinitode.py-1.1.2/infinitode.py.egg-info/PKG-INFO +0 -164
- {infinitode.py-1.1.2 → infinitode.py-1.1.3}/infinitode/badge.py +0 -0
- {infinitode.py-1.1.2 → infinitode.py-1.1.3}/infinitode/core.py +0 -0
- {infinitode.py-1.1.2 → infinitode.py-1.1.3}/infinitode/errors.py +0 -0
- {infinitode.py-1.1.2 → infinitode.py-1.1.3}/infinitode/player.py +0 -0
- {infinitode.py-1.1.2 → infinitode.py-1.1.3}/infinitode/py.typed +0 -0
- {infinitode.py-1.1.2 → infinitode.py-1.1.3}/infinitode/score.py +0 -0
- {infinitode.py-1.1.2 → infinitode.py-1.1.3}/infinitode/utils.py +0 -0
- {infinitode.py-1.1.2 → infinitode.py-1.1.3}/infinitode.py.egg-info/SOURCES.txt +0 -0
- {infinitode.py-1.1.2 → infinitode.py-1.1.3}/infinitode.py.egg-info/dependency_links.txt +0 -0
- {infinitode.py-1.1.2 → infinitode.py-1.1.3}/infinitode.py.egg-info/requires.txt +0 -0
- {infinitode.py-1.1.2 → infinitode.py-1.1.3}/infinitode.py.egg-info/top_level.txt +0 -0
- {infinitode.py-1.1.2 → infinitode.py-1.1.3}/setup.cfg +0 -0
- {infinitode.py-1.1.2 → infinitode.py-1.1.3}/setup.py +0 -0
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: infinitode.py
|
|
3
|
+
Version: 1.1.3
|
|
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.
|
|
@@ -67,7 +67,7 @@ class Leaderboard(Sequence[Score]):
|
|
|
67
67
|
"""Builds an instance with the given payload."""
|
|
68
68
|
player: Dict[str, Any] = payload["player"]
|
|
69
69
|
total: int = player["total"]
|
|
70
|
-
if playerid is not None and
|
|
70
|
+
if playerid is not None and player["score"]:
|
|
71
71
|
player_score = Score(method, mapname, mode, difficulty, playerid, **player)
|
|
72
72
|
else:
|
|
73
73
|
player_score = None
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: infinitode.py
|
|
3
|
+
Version: 1.1.3
|
|
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
|
+
|
infinitode.py-1.1.2/PKG-INFO
DELETED
|
@@ -1,164 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.1
|
|
2
|
-
Name: infinitode.py
|
|
3
|
-
Version: 1.1.2
|
|
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
|
-
## Installing
|
|
16
|
-
|
|
17
|
-
---
|
|
18
|
-
|
|
19
|
-
Installing via pip:
|
|
20
|
-
|
|
21
|
-
```
|
|
22
|
-
pip install infinitode.py
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
## Showcase
|
|
26
|
-
|
|
27
|
-
---
|
|
28
|
-
|
|
29
|
-
```python
|
|
30
|
-
import asyncio
|
|
31
|
-
import infinitode
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
async def main():
|
|
35
|
-
# Creates a session to communicate with Rainy's API.
|
|
36
|
-
# The with statement assures that the underlying session is closed.
|
|
37
|
-
# Alternatively you can can simply call Session.close() once you don't need it anymore.
|
|
38
|
-
async with infinitode.Session() as API:
|
|
39
|
-
|
|
40
|
-
# The mapname parameter should be in the form presented in the game (ie 5.1).
|
|
41
|
-
# The mode param (score/waves) defaults to score.
|
|
42
|
-
# The difficulty param (EASY/NORMAL/ENDLESS_I) which defaults to NORMAL can also be specified,
|
|
43
|
-
# however easy leaderboards/scores are always empty.
|
|
44
|
-
# Sometimes a playerid can or must be specified,
|
|
45
|
-
# and the result will have additional info about that players' score.
|
|
46
|
-
|
|
47
|
-
# This returns a score of a specific player with the id U-E9BP-FSN9-H6ENMQ on the map 5.1 in normal mode.
|
|
48
|
-
# The parameters mapname and playerid are required, mode and difficulty are optional.
|
|
49
|
-
score_5_1 = await API.leaderboards_rank(mapname='5.1', playerid='U-E9BP-FSN9-H6ENMQ', mode='score', difficulty='NORMAL')
|
|
50
|
-
|
|
51
|
-
# This returns a leaderboard of the top 200 wave scores on 5.1 in normal mode.
|
|
52
|
-
# Only the mapname is required.
|
|
53
|
-
# mapname can also be a float
|
|
54
|
-
leaderboard_5_1 = await API.leaderboards(mapname=5.1, playerid=None, mode='waves')
|
|
55
|
-
|
|
56
|
-
# The runtime leaderboard is the one displayed in the top right when playing a run.
|
|
57
|
-
# It is similar to leaderboards, however it will also give the top 1-99% each.
|
|
58
|
-
# Mapname and playerid are required.
|
|
59
|
-
runtime_5_1 = await API.runtime_leaderboards(mapname=5.1, playerid='U-E9BP-FSN9-H6ENMQ', difficulty='ENDLESS_I')
|
|
60
|
-
|
|
61
|
-
# Top 3 skill point owners, a playerid can be specified for the score of that player.
|
|
62
|
-
sp_leaderboard = await API.skill_point_leaderboard(playerid='U-E9BP-FSN9-H6ENMQ')
|
|
63
|
-
|
|
64
|
-
# Top 200 players of todays dailyquest or the one which date is specified.
|
|
65
|
-
# The date should be a str in the YYYY-MM-DD format, or a datetime.datetime object.
|
|
66
|
-
# However the server seems to only save the last 2 or 3 days.
|
|
67
|
-
# Again, a playerid can be specified.
|
|
68
|
-
dq_leaderboard = await API.daily_quest_leaderboards()
|
|
69
|
-
|
|
70
|
-
# This returns the top 100 players from the season leaderboard.
|
|
71
|
-
# There is no convenient api response for this call.
|
|
72
|
-
# Instead the data is parsed, which is why this can take a bit.
|
|
73
|
-
# This function never takes parameters.
|
|
74
|
-
season_leaderboard = await API.seasonal_leaderboard()
|
|
75
|
-
|
|
76
|
-
# This will return a Player with a lot of attributes.
|
|
77
|
-
# Like the season leaderboard, the data has to be parsed.
|
|
78
|
-
# This function always takes a playerid and nothing else.
|
|
79
|
-
player = await API.player('U-E9BP-FSN9-H6ENMQ')
|
|
80
|
-
|
|
81
|
-
# All Leaderboards and Scores have the method, mapname, mode, difficulty attribute:
|
|
82
|
-
print(score_5_1.method, score_5_1.mapname,
|
|
83
|
-
runtime_5_1.mode, runtime_5_1.difficulty)
|
|
84
|
-
# All leaderboards have a total attribute:
|
|
85
|
-
print(leaderboard_5_1.total)
|
|
86
|
-
|
|
87
|
-
# They also have an optional player, date and season attribute
|
|
88
|
-
print(dq_leaderboard.date)
|
|
89
|
-
print(season_leaderboard.season)
|
|
90
|
-
|
|
91
|
-
# The player attribute will return a Score
|
|
92
|
-
sp_score = sp_leaderboard.player
|
|
93
|
-
assert sp_score is not None # check if the score exists.
|
|
94
|
-
|
|
95
|
-
# Scores also always have a playerid, rank and score attribute:
|
|
96
|
-
print(score_5_1.playerid, score_5_1.rank, score_5_1.score)
|
|
97
|
-
|
|
98
|
-
# There is also a variety of optional attributes:
|
|
99
|
-
# has_pfp, level, nickname, pinned_badge, position, top, total, player
|
|
100
|
-
|
|
101
|
-
# Every Leaderboard contains a certain amount of scores, with a maxmimum of 300.
|
|
102
|
-
# The best way to retrieve the scores is usually iterating through the leaderboard.
|
|
103
|
-
# for score in leaderboard_5_1:
|
|
104
|
-
# print(score.nickname) # do something with score
|
|
105
|
-
|
|
106
|
-
# You can also index a single score:
|
|
107
|
-
leaderboard_5_1[35].print_score()
|
|
108
|
-
# or index with a slice to receive a shortened leaderboard:
|
|
109
|
-
print(len(leaderboard_5_1[0:10]))
|
|
110
|
-
|
|
111
|
-
# The last main object is a Player, received only be Session.player()
|
|
112
|
-
# Every Player has the same attributes.
|
|
113
|
-
print(
|
|
114
|
-
player.playerid,
|
|
115
|
-
player.nickname,
|
|
116
|
-
player.level,
|
|
117
|
-
player.xp,
|
|
118
|
-
player.xp_max, # xp required per level
|
|
119
|
-
player.season_level,
|
|
120
|
-
player.season_xp,
|
|
121
|
-
player.season_xp_max,
|
|
122
|
-
player.total_score,
|
|
123
|
-
player.total_rank,
|
|
124
|
-
player.total_top,
|
|
125
|
-
player.replays,
|
|
126
|
-
player.issues,
|
|
127
|
-
player.created_at, # as str
|
|
128
|
-
player.avatar_link # even when the person has no pfp
|
|
129
|
-
)
|
|
130
|
-
|
|
131
|
-
# Every player also has a .score() method. It will return the players score for the given level.
|
|
132
|
-
player.score('5.1').print_score()
|
|
133
|
-
|
|
134
|
-
# You can also get the DQ and SP scores with additional API calls:
|
|
135
|
-
(await player.daily_quest(API)).rank
|
|
136
|
-
(await player.skill_point(API)).rank
|
|
137
|
-
|
|
138
|
-
# In case you get a runtime error here, ignore it, that's Windows' shit.
|
|
139
|
-
asyncio.run(main())
|
|
140
|
-
```
|
|
141
|
-
|
|
142
|
-
## Logging
|
|
143
|
-
|
|
144
|
-
---
|
|
145
|
-
|
|
146
|
-
```python
|
|
147
|
-
import infinitode
|
|
148
|
-
import asyncio
|
|
149
|
-
import logging
|
|
150
|
-
|
|
151
|
-
# setup logger
|
|
152
|
-
# INFO will log everytime a request is made
|
|
153
|
-
# DEBUG will log the server's response aswell
|
|
154
|
-
logging.basicConfig(level=logging.INFO)
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
async def main():
|
|
158
|
-
async with infinitode.Session() as API:
|
|
159
|
-
await API.leaderboards('6.3') # just an example
|
|
160
|
-
|
|
161
|
-
asyncio.run(main())
|
|
162
|
-
```
|
|
163
|
-
|
|
164
|
-
|
infinitode.py-1.1.2/README.md
DELETED
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
# Infinitode.py
|
|
2
|
-
|
|
3
|
-
An asynchronous python wrapper for the Infinitode-2 API using `async`-`await` syntax.
|
|
4
|
-
|
|
5
|
-
## Installing
|
|
6
|
-
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
Installing via pip:
|
|
10
|
-
|
|
11
|
-
```
|
|
12
|
-
pip install infinitode.py
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
## Showcase
|
|
16
|
-
|
|
17
|
-
---
|
|
18
|
-
|
|
19
|
-
```python
|
|
20
|
-
import asyncio
|
|
21
|
-
import infinitode
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
async def main():
|
|
25
|
-
# Creates a session to communicate with Rainy's API.
|
|
26
|
-
# The with statement assures that the underlying session is closed.
|
|
27
|
-
# Alternatively you can can simply call Session.close() once you don't need it anymore.
|
|
28
|
-
async with infinitode.Session() as API:
|
|
29
|
-
|
|
30
|
-
# The mapname parameter should be in the form presented in the game (ie 5.1).
|
|
31
|
-
# The mode param (score/waves) defaults to score.
|
|
32
|
-
# The difficulty param (EASY/NORMAL/ENDLESS_I) which defaults to NORMAL can also be specified,
|
|
33
|
-
# however easy leaderboards/scores are always empty.
|
|
34
|
-
# Sometimes a playerid can or must be specified,
|
|
35
|
-
# and the result will have additional info about that players' score.
|
|
36
|
-
|
|
37
|
-
# This returns a score of a specific player with the id U-E9BP-FSN9-H6ENMQ on the map 5.1 in normal mode.
|
|
38
|
-
# The parameters mapname and playerid are required, mode and difficulty are optional.
|
|
39
|
-
score_5_1 = await API.leaderboards_rank(mapname='5.1', playerid='U-E9BP-FSN9-H6ENMQ', mode='score', difficulty='NORMAL')
|
|
40
|
-
|
|
41
|
-
# This returns a leaderboard of the top 200 wave scores on 5.1 in normal mode.
|
|
42
|
-
# Only the mapname is required.
|
|
43
|
-
# mapname can also be a float
|
|
44
|
-
leaderboard_5_1 = await API.leaderboards(mapname=5.1, playerid=None, mode='waves')
|
|
45
|
-
|
|
46
|
-
# The runtime leaderboard is the one displayed in the top right when playing a run.
|
|
47
|
-
# It is similar to leaderboards, however it will also give the top 1-99% each.
|
|
48
|
-
# Mapname and playerid are required.
|
|
49
|
-
runtime_5_1 = await API.runtime_leaderboards(mapname=5.1, playerid='U-E9BP-FSN9-H6ENMQ', difficulty='ENDLESS_I')
|
|
50
|
-
|
|
51
|
-
# Top 3 skill point owners, a playerid can be specified for the score of that player.
|
|
52
|
-
sp_leaderboard = await API.skill_point_leaderboard(playerid='U-E9BP-FSN9-H6ENMQ')
|
|
53
|
-
|
|
54
|
-
# Top 200 players of todays dailyquest or the one which date is specified.
|
|
55
|
-
# The date should be a str in the YYYY-MM-DD format, or a datetime.datetime object.
|
|
56
|
-
# However the server seems to only save the last 2 or 3 days.
|
|
57
|
-
# Again, a playerid can be specified.
|
|
58
|
-
dq_leaderboard = await API.daily_quest_leaderboards()
|
|
59
|
-
|
|
60
|
-
# This returns the top 100 players from the season leaderboard.
|
|
61
|
-
# There is no convenient api response for this call.
|
|
62
|
-
# Instead the data is parsed, which is why this can take a bit.
|
|
63
|
-
# This function never takes parameters.
|
|
64
|
-
season_leaderboard = await API.seasonal_leaderboard()
|
|
65
|
-
|
|
66
|
-
# This will return a Player with a lot of attributes.
|
|
67
|
-
# Like the season leaderboard, the data has to be parsed.
|
|
68
|
-
# This function always takes a playerid and nothing else.
|
|
69
|
-
player = await API.player('U-E9BP-FSN9-H6ENMQ')
|
|
70
|
-
|
|
71
|
-
# All Leaderboards and Scores have the method, mapname, mode, difficulty attribute:
|
|
72
|
-
print(score_5_1.method, score_5_1.mapname,
|
|
73
|
-
runtime_5_1.mode, runtime_5_1.difficulty)
|
|
74
|
-
# All leaderboards have a total attribute:
|
|
75
|
-
print(leaderboard_5_1.total)
|
|
76
|
-
|
|
77
|
-
# They also have an optional player, date and season attribute
|
|
78
|
-
print(dq_leaderboard.date)
|
|
79
|
-
print(season_leaderboard.season)
|
|
80
|
-
|
|
81
|
-
# The player attribute will return a Score
|
|
82
|
-
sp_score = sp_leaderboard.player
|
|
83
|
-
assert sp_score is not None # check if the score exists.
|
|
84
|
-
|
|
85
|
-
# Scores also always have a playerid, rank and score attribute:
|
|
86
|
-
print(score_5_1.playerid, score_5_1.rank, score_5_1.score)
|
|
87
|
-
|
|
88
|
-
# There is also a variety of optional attributes:
|
|
89
|
-
# has_pfp, level, nickname, pinned_badge, position, top, total, player
|
|
90
|
-
|
|
91
|
-
# Every Leaderboard contains a certain amount of scores, with a maxmimum of 300.
|
|
92
|
-
# The best way to retrieve the scores is usually iterating through the leaderboard.
|
|
93
|
-
# for score in leaderboard_5_1:
|
|
94
|
-
# print(score.nickname) # do something with score
|
|
95
|
-
|
|
96
|
-
# You can also index a single score:
|
|
97
|
-
leaderboard_5_1[35].print_score()
|
|
98
|
-
# or index with a slice to receive a shortened leaderboard:
|
|
99
|
-
print(len(leaderboard_5_1[0:10]))
|
|
100
|
-
|
|
101
|
-
# The last main object is a Player, received only be Session.player()
|
|
102
|
-
# Every Player has the same attributes.
|
|
103
|
-
print(
|
|
104
|
-
player.playerid,
|
|
105
|
-
player.nickname,
|
|
106
|
-
player.level,
|
|
107
|
-
player.xp,
|
|
108
|
-
player.xp_max, # xp required per level
|
|
109
|
-
player.season_level,
|
|
110
|
-
player.season_xp,
|
|
111
|
-
player.season_xp_max,
|
|
112
|
-
player.total_score,
|
|
113
|
-
player.total_rank,
|
|
114
|
-
player.total_top,
|
|
115
|
-
player.replays,
|
|
116
|
-
player.issues,
|
|
117
|
-
player.created_at, # as str
|
|
118
|
-
player.avatar_link # even when the person has no pfp
|
|
119
|
-
)
|
|
120
|
-
|
|
121
|
-
# Every player also has a .score() method. It will return the players score for the given level.
|
|
122
|
-
player.score('5.1').print_score()
|
|
123
|
-
|
|
124
|
-
# You can also get the DQ and SP scores with additional API calls:
|
|
125
|
-
(await player.daily_quest(API)).rank
|
|
126
|
-
(await player.skill_point(API)).rank
|
|
127
|
-
|
|
128
|
-
# In case you get a runtime error here, ignore it, that's Windows' shit.
|
|
129
|
-
asyncio.run(main())
|
|
130
|
-
```
|
|
131
|
-
|
|
132
|
-
## Logging
|
|
133
|
-
|
|
134
|
-
---
|
|
135
|
-
|
|
136
|
-
```python
|
|
137
|
-
import infinitode
|
|
138
|
-
import asyncio
|
|
139
|
-
import logging
|
|
140
|
-
|
|
141
|
-
# setup logger
|
|
142
|
-
# INFO will log everytime a request is made
|
|
143
|
-
# DEBUG will log the server's response aswell
|
|
144
|
-
logging.basicConfig(level=logging.INFO)
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
async def main():
|
|
148
|
-
async with infinitode.Session() as API:
|
|
149
|
-
await API.leaderboards('6.3') # just an example
|
|
150
|
-
|
|
151
|
-
asyncio.run(main())
|
|
152
|
-
```
|
|
@@ -1,164 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.1
|
|
2
|
-
Name: infinitode.py
|
|
3
|
-
Version: 1.1.2
|
|
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
|
-
## Installing
|
|
16
|
-
|
|
17
|
-
---
|
|
18
|
-
|
|
19
|
-
Installing via pip:
|
|
20
|
-
|
|
21
|
-
```
|
|
22
|
-
pip install infinitode.py
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
## Showcase
|
|
26
|
-
|
|
27
|
-
---
|
|
28
|
-
|
|
29
|
-
```python
|
|
30
|
-
import asyncio
|
|
31
|
-
import infinitode
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
async def main():
|
|
35
|
-
# Creates a session to communicate with Rainy's API.
|
|
36
|
-
# The with statement assures that the underlying session is closed.
|
|
37
|
-
# Alternatively you can can simply call Session.close() once you don't need it anymore.
|
|
38
|
-
async with infinitode.Session() as API:
|
|
39
|
-
|
|
40
|
-
# The mapname parameter should be in the form presented in the game (ie 5.1).
|
|
41
|
-
# The mode param (score/waves) defaults to score.
|
|
42
|
-
# The difficulty param (EASY/NORMAL/ENDLESS_I) which defaults to NORMAL can also be specified,
|
|
43
|
-
# however easy leaderboards/scores are always empty.
|
|
44
|
-
# Sometimes a playerid can or must be specified,
|
|
45
|
-
# and the result will have additional info about that players' score.
|
|
46
|
-
|
|
47
|
-
# This returns a score of a specific player with the id U-E9BP-FSN9-H6ENMQ on the map 5.1 in normal mode.
|
|
48
|
-
# The parameters mapname and playerid are required, mode and difficulty are optional.
|
|
49
|
-
score_5_1 = await API.leaderboards_rank(mapname='5.1', playerid='U-E9BP-FSN9-H6ENMQ', mode='score', difficulty='NORMAL')
|
|
50
|
-
|
|
51
|
-
# This returns a leaderboard of the top 200 wave scores on 5.1 in normal mode.
|
|
52
|
-
# Only the mapname is required.
|
|
53
|
-
# mapname can also be a float
|
|
54
|
-
leaderboard_5_1 = await API.leaderboards(mapname=5.1, playerid=None, mode='waves')
|
|
55
|
-
|
|
56
|
-
# The runtime leaderboard is the one displayed in the top right when playing a run.
|
|
57
|
-
# It is similar to leaderboards, however it will also give the top 1-99% each.
|
|
58
|
-
# Mapname and playerid are required.
|
|
59
|
-
runtime_5_1 = await API.runtime_leaderboards(mapname=5.1, playerid='U-E9BP-FSN9-H6ENMQ', difficulty='ENDLESS_I')
|
|
60
|
-
|
|
61
|
-
# Top 3 skill point owners, a playerid can be specified for the score of that player.
|
|
62
|
-
sp_leaderboard = await API.skill_point_leaderboard(playerid='U-E9BP-FSN9-H6ENMQ')
|
|
63
|
-
|
|
64
|
-
# Top 200 players of todays dailyquest or the one which date is specified.
|
|
65
|
-
# The date should be a str in the YYYY-MM-DD format, or a datetime.datetime object.
|
|
66
|
-
# However the server seems to only save the last 2 or 3 days.
|
|
67
|
-
# Again, a playerid can be specified.
|
|
68
|
-
dq_leaderboard = await API.daily_quest_leaderboards()
|
|
69
|
-
|
|
70
|
-
# This returns the top 100 players from the season leaderboard.
|
|
71
|
-
# There is no convenient api response for this call.
|
|
72
|
-
# Instead the data is parsed, which is why this can take a bit.
|
|
73
|
-
# This function never takes parameters.
|
|
74
|
-
season_leaderboard = await API.seasonal_leaderboard()
|
|
75
|
-
|
|
76
|
-
# This will return a Player with a lot of attributes.
|
|
77
|
-
# Like the season leaderboard, the data has to be parsed.
|
|
78
|
-
# This function always takes a playerid and nothing else.
|
|
79
|
-
player = await API.player('U-E9BP-FSN9-H6ENMQ')
|
|
80
|
-
|
|
81
|
-
# All Leaderboards and Scores have the method, mapname, mode, difficulty attribute:
|
|
82
|
-
print(score_5_1.method, score_5_1.mapname,
|
|
83
|
-
runtime_5_1.mode, runtime_5_1.difficulty)
|
|
84
|
-
# All leaderboards have a total attribute:
|
|
85
|
-
print(leaderboard_5_1.total)
|
|
86
|
-
|
|
87
|
-
# They also have an optional player, date and season attribute
|
|
88
|
-
print(dq_leaderboard.date)
|
|
89
|
-
print(season_leaderboard.season)
|
|
90
|
-
|
|
91
|
-
# The player attribute will return a Score
|
|
92
|
-
sp_score = sp_leaderboard.player
|
|
93
|
-
assert sp_score is not None # check if the score exists.
|
|
94
|
-
|
|
95
|
-
# Scores also always have a playerid, rank and score attribute:
|
|
96
|
-
print(score_5_1.playerid, score_5_1.rank, score_5_1.score)
|
|
97
|
-
|
|
98
|
-
# There is also a variety of optional attributes:
|
|
99
|
-
# has_pfp, level, nickname, pinned_badge, position, top, total, player
|
|
100
|
-
|
|
101
|
-
# Every Leaderboard contains a certain amount of scores, with a maxmimum of 300.
|
|
102
|
-
# The best way to retrieve the scores is usually iterating through the leaderboard.
|
|
103
|
-
# for score in leaderboard_5_1:
|
|
104
|
-
# print(score.nickname) # do something with score
|
|
105
|
-
|
|
106
|
-
# You can also index a single score:
|
|
107
|
-
leaderboard_5_1[35].print_score()
|
|
108
|
-
# or index with a slice to receive a shortened leaderboard:
|
|
109
|
-
print(len(leaderboard_5_1[0:10]))
|
|
110
|
-
|
|
111
|
-
# The last main object is a Player, received only be Session.player()
|
|
112
|
-
# Every Player has the same attributes.
|
|
113
|
-
print(
|
|
114
|
-
player.playerid,
|
|
115
|
-
player.nickname,
|
|
116
|
-
player.level,
|
|
117
|
-
player.xp,
|
|
118
|
-
player.xp_max, # xp required per level
|
|
119
|
-
player.season_level,
|
|
120
|
-
player.season_xp,
|
|
121
|
-
player.season_xp_max,
|
|
122
|
-
player.total_score,
|
|
123
|
-
player.total_rank,
|
|
124
|
-
player.total_top,
|
|
125
|
-
player.replays,
|
|
126
|
-
player.issues,
|
|
127
|
-
player.created_at, # as str
|
|
128
|
-
player.avatar_link # even when the person has no pfp
|
|
129
|
-
)
|
|
130
|
-
|
|
131
|
-
# Every player also has a .score() method. It will return the players score for the given level.
|
|
132
|
-
player.score('5.1').print_score()
|
|
133
|
-
|
|
134
|
-
# You can also get the DQ and SP scores with additional API calls:
|
|
135
|
-
(await player.daily_quest(API)).rank
|
|
136
|
-
(await player.skill_point(API)).rank
|
|
137
|
-
|
|
138
|
-
# In case you get a runtime error here, ignore it, that's Windows' shit.
|
|
139
|
-
asyncio.run(main())
|
|
140
|
-
```
|
|
141
|
-
|
|
142
|
-
## Logging
|
|
143
|
-
|
|
144
|
-
---
|
|
145
|
-
|
|
146
|
-
```python
|
|
147
|
-
import infinitode
|
|
148
|
-
import asyncio
|
|
149
|
-
import logging
|
|
150
|
-
|
|
151
|
-
# setup logger
|
|
152
|
-
# INFO will log everytime a request is made
|
|
153
|
-
# DEBUG will log the server's response aswell
|
|
154
|
-
logging.basicConfig(level=logging.INFO)
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
async def main():
|
|
158
|
-
async with infinitode.Session() as API:
|
|
159
|
-
await API.leaderboards('6.3') # just an example
|
|
160
|
-
|
|
161
|
-
asyncio.run(main())
|
|
162
|
-
```
|
|
163
|
-
|
|
164
|
-
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|