maps4fs 1.8.234__py3-none-any.whl → 1.8.235__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.
- maps4fs/generator/statistics.py +31 -9
- {maps4fs-1.8.234.dist-info → maps4fs-1.8.235.dist-info}/METADATA +1 -1
- {maps4fs-1.8.234.dist-info → maps4fs-1.8.235.dist-info}/RECORD +6 -6
- {maps4fs-1.8.234.dist-info → maps4fs-1.8.235.dist-info}/LICENSE.md +0 -0
- {maps4fs-1.8.234.dist-info → maps4fs-1.8.235.dist-info}/WHEEL +0 -0
- {maps4fs-1.8.234.dist-info → maps4fs-1.8.235.dist-info}/top_level.txt +0 -0
maps4fs/generator/statistics.py
CHANGED
@@ -24,23 +24,27 @@ if not API_TOKEN:
|
|
24
24
|
logger.debug("API_TOKEN not set in environment")
|
25
25
|
|
26
26
|
|
27
|
-
def
|
28
|
-
"""
|
27
|
+
def post(endpoint: str, data: dict[str, Any]) -> dict[str, Any] | None:
|
28
|
+
"""Make a POST request to the statistics server.
|
29
29
|
|
30
30
|
Arguments:
|
31
|
-
endpoint (str): The endpoint to send the
|
32
|
-
data (dict[str, Any]): The
|
31
|
+
endpoint (str): The endpoint to send the request to.
|
32
|
+
data (dict[str, Any]): The data to send.
|
33
|
+
|
34
|
+
Returns:
|
35
|
+
dict[str, Any]: The response from the server.
|
33
36
|
"""
|
34
37
|
if not STATS_HOST or not API_TOKEN:
|
35
38
|
logger.info("STATS_HOST or API_TOKEN not set in environment, can't send settings.")
|
36
|
-
return
|
39
|
+
return None
|
37
40
|
|
38
41
|
headers = {"Authorization": f"Bearer {API_TOKEN}", "Content-Type": "application/json"}
|
39
42
|
response = requests.post(endpoint, headers=headers, json=data, timeout=10)
|
40
43
|
if response.status_code != 200:
|
41
44
|
logger.error("Failed to send settings: %s", response.text)
|
42
|
-
|
43
|
-
|
45
|
+
return None
|
46
|
+
logger.info("Settings sent successfully")
|
47
|
+
return response.json()
|
44
48
|
|
45
49
|
|
46
50
|
def send_main_settings(data: dict[str, Any]) -> None:
|
@@ -50,7 +54,7 @@ def send_main_settings(data: dict[str, Any]) -> None:
|
|
50
54
|
data (dict[str, Any]): The main settings to send.
|
51
55
|
"""
|
52
56
|
endpoint = f"{STATS_HOST}/receive_main_settings"
|
53
|
-
|
57
|
+
post(endpoint, data)
|
54
58
|
|
55
59
|
|
56
60
|
def send_advanced_settings(data: dict[str, Any]) -> None:
|
@@ -60,4 +64,22 @@ def send_advanced_settings(data: dict[str, Any]) -> None:
|
|
60
64
|
data (dict[str, Any]): The advanced settings to send.
|
61
65
|
"""
|
62
66
|
endpoint = f"{STATS_HOST}/receive_advanced_settings"
|
63
|
-
|
67
|
+
post(endpoint, data)
|
68
|
+
|
69
|
+
|
70
|
+
def get_main_settings(fields: list[str], limit: int | None = None) -> list[dict[str, Any]] | None:
|
71
|
+
"""Get main settings from the statistics server.
|
72
|
+
|
73
|
+
Arguments:
|
74
|
+
fields (list[str]): The fields to get.
|
75
|
+
limit (int | None): The maximum number of settings to get.
|
76
|
+
|
77
|
+
Returns:
|
78
|
+
list[dict[str, Any]]: The settings from the server.
|
79
|
+
"""
|
80
|
+
endpoint = f"{STATS_HOST}/get_main_settings"
|
81
|
+
data = {"fields": fields, "limit": limit}
|
82
|
+
result = post(endpoint, data)
|
83
|
+
if not result:
|
84
|
+
return None
|
85
|
+
return result.get("settings")
|
@@ -6,7 +6,7 @@ maps4fs/generator/game.py,sha256=NZaxj5z7WzMiHzAvQyr-TvVjGoHgqGldM6ZsItuYyzA,112
|
|
6
6
|
maps4fs/generator/map.py,sha256=tgbpu3xxtFFWMualvaOnfnBXjDYWqAa_xIpu-OvcnbQ,12636
|
7
7
|
maps4fs/generator/qgis.py,sha256=Es8hLuqN_KH8lDfnJE6He2rWYbAKJ3RGPn-o87S6CPI,6116
|
8
8
|
maps4fs/generator/settings.py,sha256=DJCG--Z__JBEc-fllWOvnb4roYuNFv7bSkAclUZV2gE,6786
|
9
|
-
maps4fs/generator/statistics.py,sha256=
|
9
|
+
maps4fs/generator/statistics.py,sha256=aynS3zbAtiwnU_YLKHPTiiaKW98_suvQUhy1SGBA6mc,2448
|
10
10
|
maps4fs/generator/component/__init__.py,sha256=s01yVVVi8R2xxNvflu2D6wTd9I_g73AMM2x7vAC7GX4,490
|
11
11
|
maps4fs/generator/component/background.py,sha256=7YkSFrbPHN_dTh4xB1lM60mloLJXOdXZw19T0Gs4x1k,18971
|
12
12
|
maps4fs/generator/component/config.py,sha256=RitKgFDZPzjA1fi8GcEi1na75qqaueUvpcITHjBvCXc,3674
|
@@ -53,8 +53,8 @@ maps4fs/toolbox/__init__.py,sha256=zZMLEkGzb4z0xql650gOtGSvcgX58DnJ2yN3vC2daRk,4
|
|
53
53
|
maps4fs/toolbox/background.py,sha256=RclEqxEWLbMxuEkkegQP8jybzugwQ1_R3rdfDe0s21U,2104
|
54
54
|
maps4fs/toolbox/custom_osm.py,sha256=X6ZlPqiOhNjkmdD_qVroIfdOl9Rb90cDwVSLDVYgx80,1892
|
55
55
|
maps4fs/toolbox/dem.py,sha256=z9IPFNmYbjiigb3t02ZenI3Mo8odd19c5MZbjDEovTo,3525
|
56
|
-
maps4fs-1.8.
|
57
|
-
maps4fs-1.8.
|
58
|
-
maps4fs-1.8.
|
59
|
-
maps4fs-1.8.
|
60
|
-
maps4fs-1.8.
|
56
|
+
maps4fs-1.8.235.dist-info/LICENSE.md,sha256=pTKD_oUexcn-yccFCTrMeLkZy0ifLRa-VNcDLqLZaIw,10749
|
57
|
+
maps4fs-1.8.235.dist-info/METADATA,sha256=1xbg950DUENzpMbqA1MXVSnwzdq6f5Ypb6nb_2Z4oEk,46039
|
58
|
+
maps4fs-1.8.235.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
59
|
+
maps4fs-1.8.235.dist-info/top_level.txt,sha256=Ue9DSRlejRQRCaJueB0uLcKrWwsEq9zezfv5dI5mV1M,8
|
60
|
+
maps4fs-1.8.235.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|