pysportbot 0.0.8__py3-none-any.whl → 0.0.10__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.
- pysportbot/__init__.py +1 -2
- pysportbot/service/__main__.py +2 -2
- pysportbot/service/booking.py +2 -2
- pysportbot/service/config_loader.py +3 -3
- pysportbot/service/config_validator.py +3 -3
- pysportbot/service/service.py +2 -2
- pysportbot/utils/logger.py +2 -2
- {pysportbot-0.0.8.dist-info → pysportbot-0.0.10.dist-info}/METADATA +11 -11
- {pysportbot-0.0.8.dist-info → pysportbot-0.0.10.dist-info}/RECORD +11 -11
- {pysportbot-0.0.8.dist-info → pysportbot-0.0.10.dist-info}/LICENSE +0 -0
- {pysportbot-0.0.8.dist-info → pysportbot-0.0.10.dist-info}/WHEEL +0 -0
pysportbot/__init__.py
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
# pysportbot/sportbot.py
|
2
2
|
|
3
3
|
import logging
|
4
|
-
from typing import Optional
|
5
4
|
|
6
5
|
from pandas import DataFrame
|
7
6
|
|
@@ -25,7 +24,7 @@ class SportBot:
|
|
25
24
|
self._logger.info(f"Time zone: {time_zone}")
|
26
25
|
self._centres = Centres(print_centres)
|
27
26
|
self._session: Session = Session()
|
28
|
-
self._auth:
|
27
|
+
self._auth: Authenticator | None = None
|
29
28
|
self._activities: Activities = Activities(self._session)
|
30
29
|
self._bookings: Bookings = Bookings(self._session)
|
31
30
|
self._df_activities: DataFrame | None = None
|
pysportbot/service/__main__.py
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env python3
|
2
2
|
|
3
3
|
import argparse
|
4
|
-
from typing import Any
|
4
|
+
from typing import Any
|
5
5
|
|
6
6
|
from .config_loader import load_config
|
7
7
|
from .service import run_service
|
@@ -23,7 +23,7 @@ def main() -> None:
|
|
23
23
|
)
|
24
24
|
args = parser.parse_args()
|
25
25
|
|
26
|
-
config:
|
26
|
+
config: dict[str, Any] = load_config(args.config)
|
27
27
|
run_service(
|
28
28
|
config,
|
29
29
|
booking_delay=args.booking_delay,
|
pysportbot/service/booking.py
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
import time
|
2
2
|
from concurrent.futures import ThreadPoolExecutor, as_completed
|
3
3
|
from datetime import datetime
|
4
|
-
from typing import Any
|
4
|
+
from typing import Any
|
5
5
|
|
6
6
|
import pytz
|
7
7
|
|
@@ -95,7 +95,7 @@ def attempt_booking(
|
|
95
95
|
|
96
96
|
def schedule_bookings(
|
97
97
|
bot: SportBot,
|
98
|
-
config:
|
98
|
+
config: dict[str, Any],
|
99
99
|
booking_delay: int,
|
100
100
|
retry_attempts: int,
|
101
101
|
retry_delay: int,
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import json
|
2
|
-
from typing import Any,
|
2
|
+
from typing import Any, cast
|
3
3
|
|
4
4
|
|
5
|
-
def load_config(config_path: str) ->
|
5
|
+
def load_config(config_path: str) -> dict[str, Any]:
|
6
6
|
with open(config_path) as f:
|
7
|
-
return cast(
|
7
|
+
return cast(dict[str, Any], json.load(f))
|
@@ -1,5 +1,5 @@
|
|
1
1
|
from datetime import datetime
|
2
|
-
from typing import Any
|
2
|
+
from typing import Any
|
3
3
|
|
4
4
|
from pysportbot import SportBot
|
5
5
|
from pysportbot.utils.errors import ErrorMessages
|
@@ -10,7 +10,7 @@ logger = get_logger(__name__)
|
|
10
10
|
DAY_MAP = {"monday": 0, "tuesday": 1, "wednesday": 2, "thursday": 3, "friday": 4, "saturday": 5, "sunday": 6}
|
11
11
|
|
12
12
|
|
13
|
-
def validate_config(config:
|
13
|
+
def validate_config(config: dict[str, Any]) -> None:
|
14
14
|
"""
|
15
15
|
Validate the overall configuration structure and values.
|
16
16
|
|
@@ -48,7 +48,7 @@ def validate_config(config: Dict[str, Any]) -> None:
|
|
48
48
|
raise ValueError(ErrorMessages.invalid_class_definition())
|
49
49
|
|
50
50
|
|
51
|
-
def validate_activities(bot: SportBot, config:
|
51
|
+
def validate_activities(bot: SportBot, config: dict[str, Any]) -> None:
|
52
52
|
"""
|
53
53
|
Validate that all activities specified in the configuration exist.
|
54
54
|
|
pysportbot/service/service.py
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
from typing import Any
|
1
|
+
from typing import Any
|
2
2
|
|
3
3
|
from pysportbot import SportBot
|
4
4
|
from pysportbot.service.booking import schedule_bookings
|
@@ -8,7 +8,7 @@ from pysportbot.utils.logger import get_logger
|
|
8
8
|
|
9
9
|
|
10
10
|
def run_service(
|
11
|
-
config:
|
11
|
+
config: dict[str, Any],
|
12
12
|
booking_delay: int,
|
13
13
|
retry_attempts: int,
|
14
14
|
retry_delay: int,
|
pysportbot/utils/logger.py
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
import logging
|
2
2
|
import threading
|
3
3
|
from datetime import datetime
|
4
|
-
from typing import ClassVar
|
4
|
+
from typing import ClassVar
|
5
5
|
|
6
6
|
import pytz
|
7
7
|
|
@@ -52,7 +52,7 @@ class ColorFormatter(logging.Formatter):
|
|
52
52
|
self.include_threads = include_threads
|
53
53
|
self.thread_colors: dict[str, str] = {} # Initialize empty dictionary
|
54
54
|
|
55
|
-
def formatTime(self, record: logging.LogRecord, datefmt:
|
55
|
+
def formatTime(self, record: logging.LogRecord, datefmt: str | None = None) -> str:
|
56
56
|
"""
|
57
57
|
Override to format the time in the desired timezone.
|
58
58
|
"""
|
@@ -1,12 +1,11 @@
|
|
1
1
|
Metadata-Version: 2.3
|
2
2
|
Name: pysportbot
|
3
|
-
Version: 0.0.
|
3
|
+
Version: 0.0.10
|
4
4
|
Summary: A python-based bot for automatic resasports slot booking
|
5
5
|
Author: Joshua Falco Beirer
|
6
6
|
Author-email: jbeirer@cern.ch
|
7
|
-
Requires-Python: >=3.
|
7
|
+
Requires-Python: >=3.10,<3.14
|
8
8
|
Classifier: Programming Language :: Python :: 3
|
9
|
-
Classifier: Programming Language :: Python :: 3.9
|
10
9
|
Classifier: Programming Language :: Python :: 3.10
|
11
10
|
Classifier: Programming Language :: Python :: 3.11
|
12
11
|
Classifier: Programming Language :: Python :: 3.12
|
@@ -110,20 +109,21 @@ Let's say you would like to book Yoga next Monday at 18:00:00, but the execution
|
|
110
109
|
}
|
111
110
|
```
|
112
111
|
|
113
|
-
**Note:** By default,
|
112
|
+
**Note:** By default, PySportBot will attempt to execute *N* bookings in parallel, where *N* is the number of available cores on your machine.
|
114
113
|
|
115
114
|
The service also provides various other options that can be inspected with
|
116
115
|
|
117
116
|
```bash
|
118
117
|
python -m pysportbot.service --help
|
119
118
|
```
|
120
|
-
Currently supported options include
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
119
|
+
Currently supported options include:
|
120
|
+
|
121
|
+
1. `--booking-delay`: sets a global delay in seconds before booking execution [default: 0]
|
122
|
+
2. `--retry-attempts`: sets the number of retries attempted in case a booking attempt fails [default: 3]
|
123
|
+
3. `--retry-delay`: sets the delay in seconds between booking retries [default: 5]
|
124
|
+
4. `--time-zone`: sets the time zone for the service [default: Europe/Madrid]
|
125
|
+
5. `--log-level`: sets the log-level of the service [default: INFO]
|
126
|
+
6. `--max-threads`: limits the number of used threads for parallel bookings [default: -1]
|
127
127
|
|
128
128
|
## LICENSE
|
129
129
|
|
@@ -1,23 +1,23 @@
|
|
1
|
-
pysportbot/__init__.py,sha256=
|
1
|
+
pysportbot/__init__.py,sha256=xrsPD3OrQGbT9ttuMp1vi-i69i4A-ePNc9IoutcJHnk,5620
|
2
2
|
pysportbot/activities.py,sha256=Aq8l570sxqEAKplsEMVkuDoPJJjoaZlIwPh6i64_SJ8,4252
|
3
3
|
pysportbot/authenticator.py,sha256=xEU9O6W6Yp9DCueoUD0ASMkm17yvdUZqTvV4h6WlSnI,5012
|
4
4
|
pysportbot/bookings.py,sha256=W91AYGPu0sCpGliuiVdlENsoGYzH8P6v-SyKisbSb7g,3127
|
5
5
|
pysportbot/centres.py,sha256=FTK-tXUOxiJvLCHP6Bk9XEQKODQZOwwkYLlioSJPBEk,3399
|
6
6
|
pysportbot/endpoints.py,sha256=ANh5JAbdzyZQ-i4ODrhYlskPpU1gkBrw9UhMC7kRSvU,1353
|
7
7
|
pysportbot/service/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
8
|
-
pysportbot/service/__main__.py,sha256=
|
9
|
-
pysportbot/service/booking.py,sha256=
|
10
|
-
pysportbot/service/config_loader.py,sha256=
|
11
|
-
pysportbot/service/config_validator.py,sha256=
|
8
|
+
pysportbot/service/__main__.py,sha256=gsKfDMOmsVC3LHCQs0Dmp7YWJBlZeGcTsX-Mx4mk6ro,1496
|
9
|
+
pysportbot/service/booking.py,sha256=ZrfIX0ghp1X_DUtknpQbY-ABi2nWFLZYAXR06cOb4lk,5616
|
10
|
+
pysportbot/service/config_loader.py,sha256=t086yaAyAKkCJTpxedwhyJ7QqSf5XROGDzjrFLsUxJE,179
|
11
|
+
pysportbot/service/config_validator.py,sha256=0P_pcXU7s3T3asODqFtv3mSp1HyPoVBphE4Qe1mxcps,2615
|
12
12
|
pysportbot/service/scheduling.py,sha256=bwqbiQQ9y4ss4UXZkWuOVCgCa9XlZt1n4TT_8z9bD7M,1973
|
13
|
-
pysportbot/service/service.py,sha256=
|
13
|
+
pysportbot/service/service.py,sha256=eW-roFozDzkK7kTzYbSzNwZhbZpBr-22yUrAHVnrD-0,1933
|
14
14
|
pysportbot/service/threading.py,sha256=j0tHgGty8iWDjpZtTzIu-5TUnDb9S6SJErm3QBpG-nY,1947
|
15
15
|
pysportbot/session.py,sha256=pTQrz3bGzLYBtzVOgKv04l4UXDSgtA3Infn368bjg5I,1529
|
16
16
|
pysportbot/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
17
17
|
pysportbot/utils/errors.py,sha256=mpTeKjOUIxJbOqL6A6apdMb7Cpto86DkrKHWfROXjMc,4979
|
18
|
-
pysportbot/utils/logger.py,sha256=
|
18
|
+
pysportbot/utils/logger.py,sha256=ANayMEeeAIVGKvITAxOFm2EdCbzBBTpNywuytAr4Z90,5366
|
19
19
|
pysportbot/utils/time.py,sha256=VZSW8AxFIoFD5ZSmLUPcwawp6PmpkcxNjP3Db-Hl_fw,1244
|
20
|
-
pysportbot-0.0.
|
21
|
-
pysportbot-0.0.
|
22
|
-
pysportbot-0.0.
|
23
|
-
pysportbot-0.0.
|
20
|
+
pysportbot-0.0.10.dist-info/LICENSE,sha256=6ov3DypdEVYpp2pn_B1MniKWO5C9iDA4O6PGcbork6c,1077
|
21
|
+
pysportbot-0.0.10.dist-info/METADATA,sha256=tWybhZ0aefyjtkRBAQZzQgALjd7tAOaMXvUPdD-Byvk,5161
|
22
|
+
pysportbot-0.0.10.dist-info/WHEEL,sha256=RaoafKOydTQ7I_I3JTrPCg6kUmTgtm4BornzOqyEfJ8,88
|
23
|
+
pysportbot-0.0.10.dist-info/RECORD,,
|
File without changes
|
File without changes
|