ctftime-api 0.1.0__tar.gz → 0.1.1__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.
- {ctftime_api-0.1.0 → ctftime_api-0.1.1}/PKG-INFO +3 -1
- {ctftime_api-0.1.0 → ctftime_api-0.1.1}/ctftime_api/client.py +27 -1
- ctftime_api-0.1.1/ctftime_api/models/vote.py +14 -0
- {ctftime_api-0.1.0 → ctftime_api-0.1.1}/pyproject.toml +3 -1
- {ctftime_api-0.1.0 → ctftime_api-0.1.1}/LICENSE +0 -0
- {ctftime_api-0.1.0 → ctftime_api-0.1.1}/README.md +0 -0
- {ctftime_api-0.1.0 → ctftime_api-0.1.1}/ctftime_api/__init__.py +0 -0
- {ctftime_api-0.1.0 → ctftime_api-0.1.1}/ctftime_api/models/__init__.py +0 -0
- {ctftime_api-0.1.0 → ctftime_api-0.1.1}/ctftime_api/models/duration.py +0 -0
- {ctftime_api-0.1.0 → ctftime_api-0.1.1}/ctftime_api/models/event.py +0 -0
- {ctftime_api-0.1.0 → ctftime_api-0.1.1}/ctftime_api/models/rating.py +0 -0
- {ctftime_api-0.1.0 → ctftime_api-0.1.1}/ctftime_api/models/team.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: ctftime_api
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.1
|
|
4
4
|
Summary: CTFTime API wrapper
|
|
5
5
|
Keywords: ctftime,api,wrapper
|
|
6
6
|
Author: John Toniutti
|
|
@@ -9,6 +9,8 @@ Requires-Python: >=3.11
|
|
|
9
9
|
Classifier: Development Status :: 3 - Alpha
|
|
10
10
|
Classifier: Intended Audience :: Developers
|
|
11
11
|
Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
|
|
12
|
+
Classifier: Framework :: Pydantic
|
|
13
|
+
Classifier: Operating System :: OS Independent
|
|
12
14
|
Classifier: Programming Language :: Python :: 3
|
|
13
15
|
Classifier: Programming Language :: Python :: 3.11
|
|
14
16
|
Classifier: Programming Language :: Python :: 3.12
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
from datetime import datetime
|
|
2
2
|
|
|
3
3
|
import httpx
|
|
4
|
-
from httpx import URL
|
|
4
|
+
from httpx import URL, Timeout
|
|
5
5
|
|
|
6
6
|
from pydantic_extra_types.country import CountryAlpha2
|
|
7
7
|
|
|
8
|
+
from ctftime_api.models.vote import Vote
|
|
8
9
|
from ctftime_api.models.event import Event, EventResult
|
|
9
10
|
from ctftime_api.models.team import TeamRank, Team, TeamComplete
|
|
10
11
|
|
|
@@ -176,3 +177,28 @@ class CTFTimeClient:
|
|
|
176
177
|
int(ctf_id): EventResult(**result, ctf_id=ctf_id)
|
|
177
178
|
for ctf_id, result in event.items()
|
|
178
179
|
}
|
|
180
|
+
|
|
181
|
+
async def get_votes_per_year(
|
|
182
|
+
self, year: int | None, timeout: Timeout | int | float | None = None
|
|
183
|
+
) -> list[Vote]:
|
|
184
|
+
"""
|
|
185
|
+
Get the votes for a specific year.
|
|
186
|
+
This API call may take a long time to complete.
|
|
187
|
+
:param year: The year to get the votes for or None for the current year.
|
|
188
|
+
:param timeout: The timeout for the request.
|
|
189
|
+
If None, the session timeout will be used.
|
|
190
|
+
:return: A list of votes.
|
|
191
|
+
"""
|
|
192
|
+
if year is None:
|
|
193
|
+
year = datetime.now().year
|
|
194
|
+
|
|
195
|
+
if timeout is None:
|
|
196
|
+
timeout = self._client.timeout
|
|
197
|
+
|
|
198
|
+
url = self._base_url.join(f"votes/{year}/")
|
|
199
|
+
response = await self._client.get(url, timeout=timeout)
|
|
200
|
+
response.raise_for_status()
|
|
201
|
+
|
|
202
|
+
votes = response.json()
|
|
203
|
+
|
|
204
|
+
return [Vote(**vote) for vote in votes]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "ctftime_api"
|
|
3
|
-
version = "0.1.
|
|
3
|
+
version = "0.1.1"
|
|
4
4
|
description = "CTFTime API wrapper"
|
|
5
5
|
authors = [
|
|
6
6
|
{name = "John Toniutti",email = "john.toniutti@gmail.com"}
|
|
@@ -10,6 +10,8 @@ classifiers = [
|
|
|
10
10
|
"Development Status :: 3 - Alpha",
|
|
11
11
|
"Intended Audience :: Developers",
|
|
12
12
|
"License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)",
|
|
13
|
+
"Framework :: Pydantic",
|
|
14
|
+
"Operating System :: OS Independent",
|
|
13
15
|
"Programming Language :: Python :: 3",
|
|
14
16
|
"Programming Language :: Python :: 3.11",
|
|
15
17
|
"Programming Language :: Python :: 3.12",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|