pysportbot 0.0.1__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 +116 -0
- pysportbot/activities.py +122 -0
- pysportbot/authenticator.py +118 -0
- pysportbot/bookings.py +87 -0
- pysportbot/centres.py +108 -0
- pysportbot/endpoints.py +40 -0
- pysportbot/service/__init__.py +0 -0
- pysportbot/service/__main__.py +32 -0
- pysportbot/service/booking.py +147 -0
- pysportbot/service/config_loader.py +7 -0
- pysportbot/service/config_validator.py +54 -0
- pysportbot/service/scheduling.py +61 -0
- pysportbot/service/service.py +47 -0
- pysportbot/session.py +47 -0
- pysportbot/utils/__init__.py +0 -0
- pysportbot/utils/errors.py +140 -0
- pysportbot/utils/logger.py +78 -0
- pysportbot/utils/time.py +39 -0
- pysportbot-0.0.1.dist-info/LICENSE +21 -0
- pysportbot-0.0.1.dist-info/METADATA +148 -0
- pysportbot-0.0.1.dist-info/RECORD +22 -0
- pysportbot-0.0.1.dist-info/WHEEL +4 -0
@@ -0,0 +1,148 @@
|
|
1
|
+
Metadata-Version: 2.1
|
2
|
+
Name: pysportbot
|
3
|
+
Version: 0.0.1
|
4
|
+
Summary: A python-based bot for automatic resasports slot booking
|
5
|
+
Home-page: https://github.com/jbeirer/pysportbot
|
6
|
+
Author: Joshua Falco Beirer
|
7
|
+
Author-email: jbeirer@cern.ch
|
8
|
+
Requires-Python: >=3.9,<3.13
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
10
|
+
Classifier: Programming Language :: Python :: 3.9
|
11
|
+
Classifier: Programming Language :: Python :: 3.10
|
12
|
+
Classifier: Programming Language :: Python :: 3.11
|
13
|
+
Classifier: Programming Language :: Python :: 3.12
|
14
|
+
Requires-Dist: beautifulsoup4 (>=4.12.3,<5.0.0)
|
15
|
+
Requires-Dist: pandas (>=2.2.3,<3.0.0)
|
16
|
+
Requires-Dist: pytz (>=2024.2,<2025.0)
|
17
|
+
Requires-Dist: requests (>=2.32.3,<3.0.0)
|
18
|
+
Requires-Dist: schedule (>=1.2.2,<2.0.0)
|
19
|
+
Project-URL: Documentation, https://jbeirer.github.io/pysportbot/
|
20
|
+
Project-URL: Repository, https://github.com/jbeirer/pysportbot
|
21
|
+
Description-Content-Type: text/markdown
|
22
|
+
|
23
|
+
# No queues. Just gains.
|
24
|
+
|
25
|
+
<img src=https://github.com/jbeirer/resasports-bot/raw/main/docs/logo.png alt="Logo" width="250">
|
26
|
+
|
27
|
+
|
28
|
+
[](https://img.shields.io/github/v/release/jbeirer/resasports-bot)
|
29
|
+
[](https://github.com/jbeirer/resasports-bot/actions/workflows/main.yml?query=branch%3Amain)
|
30
|
+
[](https://codecov.io/gh/jbeirer/resasports-bot)
|
31
|
+
[](https://img.shields.io/github/commit-activity/m/jbeirer/resasports-bot)
|
32
|
+
[](https://img.shields.io/github/license/jbeirer/resasports-bot)
|
33
|
+
|
34
|
+
|
35
|
+
Welcome to pysportbot!
|
36
|
+
|
37
|
+
## Download pysportbot
|
38
|
+
```python
|
39
|
+
pip install pysportbot
|
40
|
+
```
|
41
|
+
|
42
|
+
## Quick Start
|
43
|
+
|
44
|
+
```python
|
45
|
+
from pysportbot import SportBot
|
46
|
+
|
47
|
+
# Create bot instance, will list available centres is requested
|
48
|
+
bot = SportBot(log_level='INFO', print_centres=False)
|
49
|
+
|
50
|
+
# Connect to service with email and password as well as the name of the centre
|
51
|
+
bot.login('email', 'password', 'centre')
|
52
|
+
|
53
|
+
# List available activites
|
54
|
+
bot.activities(limit = 10)
|
55
|
+
|
56
|
+
# List bookable slots for an activity on a specific day
|
57
|
+
bot.daily_slots(activity='YourFavouriteGymClass', day = '2025-01-03', limit = 10)
|
58
|
+
|
59
|
+
# Book an activity slot on a specific day and time
|
60
|
+
bot.book(activity='YourFavouriteGymClass', start_time = '2024-12-30 07:00:00')
|
61
|
+
|
62
|
+
# Cancel an activity slot ona specific day and time
|
63
|
+
bot.cancel(activity='YourFavouriteGymClass', start_time = '2024-12-30 07:00:00')
|
64
|
+
```
|
65
|
+
|
66
|
+
## Advanced usage as service
|
67
|
+
|
68
|
+
You can easily run `pysportbot` as a service to manage your bookings automatically with
|
69
|
+
```bash
|
70
|
+
python -m pysportbot.service --config config.json
|
71
|
+
```
|
72
|
+
The service requires a `json` configuration file that specifies your user data and how you would like to book your classes. Currently, three types of configuration are supported:
|
73
|
+
|
74
|
+
##### 1. Book an upcoming class now
|
75
|
+
|
76
|
+
Let's say you would like to book Yoga next Monday at 18:00:00, then your `config.json` would look like:
|
77
|
+
|
78
|
+
```json
|
79
|
+
{
|
80
|
+
"email": "your-email",
|
81
|
+
"password": "your-password",
|
82
|
+
"center": "your-gym-name",
|
83
|
+
"classes": [
|
84
|
+
{
|
85
|
+
"activity": "Yoga",
|
86
|
+
"class_day": "Monday",
|
87
|
+
"class_time": "18:00:00",
|
88
|
+
"booking_execution": "now",
|
89
|
+
"weekly": false
|
90
|
+
}
|
91
|
+
]
|
92
|
+
}
|
93
|
+
```
|
94
|
+
##### 2. Book an upcoming class on a specific day and time
|
95
|
+
|
96
|
+
Let's say you would like to book Yoga next Monday at 18:00:00, but the execution of the booking should only happen on Friday at 07:30:00 then your `config.json` would look like:
|
97
|
+
|
98
|
+
```json
|
99
|
+
{
|
100
|
+
"email": "your-email",
|
101
|
+
"password": "your-password",
|
102
|
+
"center": "your-gym-name",
|
103
|
+
"classes": [
|
104
|
+
{
|
105
|
+
"activity": "Yoga",
|
106
|
+
"class_day": "Monday",
|
107
|
+
"class_time": "18:00:00",
|
108
|
+
"booking_execution": "Friday 07:30:00",
|
109
|
+
"weekly": false
|
110
|
+
}
|
111
|
+
]
|
112
|
+
}
|
113
|
+
```
|
114
|
+
##### 3. Schedule weekly booking at specific execution day and time
|
115
|
+
Let's say you would like to book Yoga every Monday at 18:00:00 and the booking execution should be every Friday at 07:30:00 then your `config.json` would look like:
|
116
|
+
|
117
|
+
```json
|
118
|
+
{
|
119
|
+
"email": "your-email",
|
120
|
+
"password": "your-password",
|
121
|
+
"center": "your-gym-name",
|
122
|
+
"classes": [
|
123
|
+
{
|
124
|
+
"activity": "Yoga",
|
125
|
+
"class_day": "Monday",
|
126
|
+
"class_time": "18:00:00",
|
127
|
+
"booking_execution": "Friday 07:30:00",
|
128
|
+
"weekly": true
|
129
|
+
}
|
130
|
+
]
|
131
|
+
}
|
132
|
+
```
|
133
|
+
|
134
|
+
The service also provides various other options that can be inspected with
|
135
|
+
|
136
|
+
```bash
|
137
|
+
python -m pysportbot.service --help
|
138
|
+
```
|
139
|
+
Currently supported options include
|
140
|
+
1. ```--retry-attempts``` sets the number of retries attempted in case a booking attempt fails
|
141
|
+
2. ```--retry-delay-minutes``` sets the delay in minutes between retries for weekly bookings
|
142
|
+
3. ```--time_zone``` sets the time zone for the service
|
143
|
+
|
144
|
+
## LICENSE
|
145
|
+
|
146
|
+
pysportbot is free of use and open-source. All versions are
|
147
|
+
published under the [MIT License](https://github.com/jbeirer/pysportbot/blob/main/LICENSE).
|
148
|
+
|
@@ -0,0 +1,22 @@
|
|
1
|
+
pysportbot/__init__.py,sha256=s10xvSr9vq-naixIWa2Yizmj5fYnlNvMEEPoFA2looY,4754
|
2
|
+
pysportbot/activities.py,sha256=dyZDme6CidsBeGqB9lIHFYmlRKTmDLvTJGPoize17B0,4247
|
3
|
+
pysportbot/authenticator.py,sha256=xEU9O6W6Yp9DCueoUD0ASMkm17yvdUZqTvV4h6WlSnI,5012
|
4
|
+
pysportbot/bookings.py,sha256=vJ0kw74qyirZlbQ7M9XqlKtRoGzuHR0_t6-zUdgldkI,3123
|
5
|
+
pysportbot/centres.py,sha256=f4OV_rJ4lO-mK7jZ165n-A62vVe09RKkl8Br_kXaq88,3398
|
6
|
+
pysportbot/endpoints.py,sha256=ANh5JAbdzyZQ-i4ODrhYlskPpU1gkBrw9UhMC7kRSvU,1353
|
7
|
+
pysportbot/service/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
8
|
+
pysportbot/service/__main__.py,sha256=bwpUt4udTBhcxkIozVaWBhwoTC5rtRWm36E6DBiWlQI,1182
|
9
|
+
pysportbot/service/booking.py,sha256=CNeMhYFAFi1UXIwAqtx8fKuO5jUsmnuf7VaSmkwIX1c,5425
|
10
|
+
pysportbot/service/config_loader.py,sha256=elNNwcC7kwc0lmRqj95hAA50qSmLelWv5G2E62tDxP0,185
|
11
|
+
pysportbot/service/config_validator.py,sha256=lGsSP7ubD816CQb0fZNYtdHWIXsFsZWtRLIjAMjSJRw,2167
|
12
|
+
pysportbot/service/scheduling.py,sha256=bwqbiQQ9y4ss4UXZkWuOVCgCa9XlZt1n4TT_8z9bD7M,1973
|
13
|
+
pysportbot/service/service.py,sha256=fW20cxAqfpPEMlLrooL13aFjwFVnZUKILFlDuuo_UBA,1121
|
14
|
+
pysportbot/session.py,sha256=pTQrz3bGzLYBtzVOgKv04l4UXDSgtA3Infn368bjg5I,1529
|
15
|
+
pysportbot/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
16
|
+
pysportbot/utils/errors.py,sha256=sUSs04yr_OmZeTywi1fzPsjVjkLd5iTpXlzlQqNKmgQ,5162
|
17
|
+
pysportbot/utils/logger.py,sha256=KTjHEKExC5t00L1EGNN_IjA5JogTVTjzZg7hVRvYq_8,2333
|
18
|
+
pysportbot/utils/time.py,sha256=VZSW8AxFIoFD5ZSmLUPcwawp6PmpkcxNjP3Db-Hl_fw,1244
|
19
|
+
pysportbot-0.0.1.dist-info/LICENSE,sha256=6ov3DypdEVYpp2pn_B1MniKWO5C9iDA4O6PGcbork6c,1077
|
20
|
+
pysportbot-0.0.1.dist-info/METADATA,sha256=IO7N0DlnwHyrrZqy4EwbcrRrtRusrKktahUGpRmhkG4,5189
|
21
|
+
pysportbot-0.0.1.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
22
|
+
pysportbot-0.0.1.dist-info/RECORD,,
|