Compare commits
55 Commits
main
..
19e3f751ec
| Author | SHA1 | Date | |
|---|---|---|---|
|
19e3f751ec
|
|||
|
afcd230c3a
|
|||
|
4593f9e8fb
|
|||
|
40c3131b90
|
|||
|
c3098cb415
|
|||
|
8f9aec7631
|
|||
|
bf7f7273e9
|
|||
|
071324d199
|
|||
|
51ee0b6b32
|
|||
|
9c99787b1f
|
|||
|
8bb89eabdc
|
|||
|
eca5eacd70
|
|||
|
5e17fd27d6
|
|||
|
9dcf4f6fd3
|
|||
|
ac8e252a2b
|
|||
|
1863f5586b
|
|||
| c83bb2af9b | |||
|
4c90716355
|
|||
|
a3360f3a1b
|
|||
|
b74c820387
|
|||
|
b5cc0f4888
|
|||
|
e85aaf143e
|
|||
|
c21afdebc0
|
|||
|
11d9aa0290
|
|||
|
33d3dee358
|
|||
|
8ae1c33b3a
|
|||
|
ce42f489bf
|
|||
|
e7615de98b
|
|||
|
394d71f59c
|
|||
|
b016d58d84
|
|||
|
6232e91925
|
|||
| 7ce4fbd756 | |||
| bb62acfc7f | |||
|
5f6ae79bf0
|
|||
|
697788c20f
|
|||
|
5c5828cfc1
|
|||
|
0a88217443
|
|||
|
2d783778a7
|
|||
|
a3d4114044
|
|||
|
cec54a45d7
|
|||
|
3efa7101e1
|
|||
|
861ff0650f
|
|||
|
73f72d1bbe
|
|||
|
a407a108ed
|
|||
|
d6277d7766
|
|||
|
5b1d741a16
|
|||
|
5957868e0f
|
|||
|
525d3bf326
|
|||
|
0e1eb0da3f
|
|||
|
4b81cc7f9f
|
|||
|
c4d9236b16
|
|||
|
2a5883375f
|
|||
|
c4b6e39e9e
|
|||
|
d3b5b6b6fd
|
|||
|
bcde9fccf5
|
@@ -169,4 +169,3 @@ cython_debug/
|
|||||||
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
||||||
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
||||||
#.idea/
|
#.idea/
|
||||||
strix_runs/*
|
|
||||||
|
|||||||
+21
-24
@@ -594,16 +594,16 @@ mobile_headers = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# def curl_for_mobile_login(username: str, password: str) -> str:
|
def curl_for_mobile_login(username: str, password: str) -> str:
|
||||||
# """Generate curl command to replicate mobile_login request."""
|
"""Generate curl command to replicate mobile_login request."""
|
||||||
# import base64
|
import base64
|
||||||
|
|
||||||
# headers_str = " ".join([f"-H '{k}: {v}'" for k, v in mobile_headers.items()])
|
headers_str = " ".join([f"-H '{k}: {v}'" for k, v in mobile_headers.items()])
|
||||||
# encoded_username = base64.b64encode(username.encode()).decode()
|
encoded_username = base64.b64encode(username.encode()).decode()
|
||||||
# encoded_password = base64.b64encode(password.encode()).decode()
|
encoded_password = base64.b64encode(password.encode()).decode()
|
||||||
# return f"""curl -X POST "https://app.myice.hockey/api/mobilerest/login" \
|
return f"""curl -X POST "https://app.myice.hockey/api/mobilerest/login" \
|
||||||
# {headers_str} \
|
{headers_str} \
|
||||||
# -d 'login_email={encoded_username}&login_password={encoded_password}&language=FR&v=2'"""
|
-d 'login_email={encoded_username}&login_password={encoded_password}&language=FR&v=2'"""
|
||||||
|
|
||||||
|
|
||||||
def mobile_login(config_section: str | None = None):
|
def mobile_login(config_section: str | None = None):
|
||||||
@@ -619,7 +619,7 @@ def mobile_login(config_section: str | None = None):
|
|||||||
|
|
||||||
print("Requesting token", file=sys.stderr)
|
print("Requesting token", file=sys.stderr)
|
||||||
# Print curl equivalent for debugging
|
# Print curl equivalent for debugging
|
||||||
# print(curl_for_mobile_login(username, password), file=sys.stderr)
|
print(curl_for_mobile_login(username, password), file=sys.stderr)
|
||||||
with requests.post(
|
with requests.post(
|
||||||
"https://app.myice.hockey/api/mobilerest/login",
|
"https://app.myice.hockey/api/mobilerest/login",
|
||||||
headers=mobile_headers,
|
headers=mobile_headers,
|
||||||
@@ -643,26 +643,23 @@ userdata = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# def curl_for_refresh_data(token: str, club_id: int) -> str:
|
def curl_for_refresh_data(token: str, club_id: int) -> str:
|
||||||
# """Generate curl command to replicate refresh_data request."""
|
"""Generate curl command to replicate refresh_data request."""
|
||||||
# headers_str = " ".join([f"-H '{k}: {v}'" for k, v in mobile_headers.items()])
|
headers_str = " ".join([f"-H '{k}: {v}'" for k, v in mobile_headers.items()])
|
||||||
# return f"""curl -X POST "https://app.myice.hockey/api/mobilerest/refreshdata" \
|
return f"""curl -X POST "https://app.myice.hockey/api/mobilerest/refreshdata" \
|
||||||
# {headers_str} \
|
{headers_str} \
|
||||||
# -d 'token={token}&id_club={club_id}&language=FR'"""
|
-d 'token={token}&id_club={club_id}&language=FR'"""
|
||||||
|
|
||||||
|
|
||||||
def refresh_data(user_data=None):
|
def refresh_data():
|
||||||
# Use provided user_data or fall back to global userdata for backward compatibility
|
|
||||||
if user_data is None:
|
|
||||||
user_data = userdata
|
|
||||||
# Print curl equivalent for debugging
|
# Print curl equivalent for debugging
|
||||||
# print(
|
print(
|
||||||
# curl_for_refresh_data(user_data["token"], user_data["id_club"]), file=sys.stderr
|
curl_for_refresh_data(userdata["token"], userdata["id_club"]), file=sys.stderr
|
||||||
# )
|
)
|
||||||
with requests.post(
|
with requests.post(
|
||||||
"https://app.myice.hockey/api/mobilerest/refreshdata",
|
"https://app.myice.hockey/api/mobilerest/refreshdata",
|
||||||
headers=mobile_headers,
|
headers=mobile_headers,
|
||||||
data=f"token={user_data['token']}&id_club={user_data['id_club']}&language=FR",
|
data=f"token={userdata['token']}&id_club={userdata['id_club']}&language=FR",
|
||||||
# verify=False,
|
# verify=False,
|
||||||
) as r:
|
) as r:
|
||||||
r.raise_for_status()
|
r.raise_for_status()
|
||||||
|
|||||||
+8
-8
@@ -352,15 +352,15 @@ async def schedule(
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
if existing_token:
|
if existing_token:
|
||||||
user_data = {
|
myice.userdata = {
|
||||||
"id": userid,
|
"id": userid,
|
||||||
"id_club": club_id or 186,
|
"id_club": club_id or 186,
|
||||||
"token": existing_token,
|
"token": existing_token,
|
||||||
}
|
}
|
||||||
else:
|
else:
|
||||||
user_data = myice.mobile_login(config_section=account)
|
myice.userdata = myice.mobile_login(config_section=account)
|
||||||
|
|
||||||
data = myice.refresh_data(user_data=user_data)
|
data = myice.refresh_data()
|
||||||
if "club_games" in data:
|
if "club_games" in data:
|
||||||
return data["club_games"]
|
return data["club_games"]
|
||||||
else:
|
else:
|
||||||
@@ -433,13 +433,13 @@ async def game(
|
|||||||
config_section=account
|
config_section=account
|
||||||
)
|
)
|
||||||
if existing_token:
|
if existing_token:
|
||||||
user_data = {
|
myice.userdata = {
|
||||||
"id": userid,
|
"id": userid,
|
||||||
"id_club": club_id or 186,
|
"id_club": club_id or 186,
|
||||||
"token": existing_token,
|
"token": existing_token,
|
||||||
}
|
}
|
||||||
else:
|
else:
|
||||||
user_data = myice.mobile_login(config_section=account)
|
myice.userdata = myice.mobile_login(config_section=account)
|
||||||
|
|
||||||
# data = refresh_data()
|
# data = refresh_data()
|
||||||
with requests.post(
|
with requests.post(
|
||||||
@@ -447,11 +447,11 @@ async def game(
|
|||||||
headers=myice.mobile_headers,
|
headers=myice.mobile_headers,
|
||||||
data="&".join(
|
data="&".join(
|
||||||
[
|
[
|
||||||
f"token={user_data['token']}",
|
f"token={myice.userdata['token']}",
|
||||||
f"id_event={game_id}",
|
f"id_event={game_id}",
|
||||||
"type=games",
|
"type=games",
|
||||||
f"id_player={user_data['id']}",
|
f"id_player={myice.userdata['id']}",
|
||||||
f"id_club={user_data['id_club']}",
|
f"id_club={myice.userdata['id_club']}",
|
||||||
"language=FR",
|
"language=FR",
|
||||||
]
|
]
|
||||||
),
|
),
|
||||||
|
|||||||
Reference in New Issue
Block a user