foxapi 1.9.0__tar.gz → 2.1.0__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.
- {foxapi-1.9.0 → foxapi-2.1.0}/PKG-INFO +82 -38
- {foxapi-1.9.0 → foxapi-2.1.0}/README.md +81 -37
- {foxapi-1.9.0 → foxapi-2.1.0}/foxapi/__init__.py +3 -2
- {foxapi-1.9.0 → foxapi-2.1.0}/foxapi/foxapi.py +85 -57
- foxapi-2.1.0/foxapi/objects.py +199 -0
- {foxapi-1.9.0 → foxapi-2.1.0}/foxapi/utils.py +5 -51
- {foxapi-1.9.0 → foxapi-2.1.0}/foxapi.egg-info/PKG-INFO +82 -38
- {foxapi-1.9.0 → foxapi-2.1.0}/foxapi.egg-info/SOURCES.txt +1 -0
- {foxapi-1.9.0 → foxapi-2.1.0}/LICENSE +0 -0
- {foxapi-1.9.0 → foxapi-2.1.0}/foxapi/Images/MapIcons/10.png +0 -0
- {foxapi-1.9.0 → foxapi-2.1.0}/foxapi/Images/MapIcons/11.png +0 -0
- {foxapi-1.9.0 → foxapi-2.1.0}/foxapi/Images/MapIcons/12.png +0 -0
- {foxapi-1.9.0 → foxapi-2.1.0}/foxapi/Images/MapIcons/13.png +0 -0
- {foxapi-1.9.0 → foxapi-2.1.0}/foxapi/Images/MapIcons/14.png +0 -0
- {foxapi-1.9.0 → foxapi-2.1.0}/foxapi/Images/MapIcons/15.png +0 -0
- {foxapi-1.9.0 → foxapi-2.1.0}/foxapi/Images/MapIcons/16.png +0 -0
- {foxapi-1.9.0 → foxapi-2.1.0}/foxapi/Images/MapIcons/17.png +0 -0
- {foxapi-1.9.0 → foxapi-2.1.0}/foxapi/Images/MapIcons/18.png +0 -0
- {foxapi-1.9.0 → foxapi-2.1.0}/foxapi/Images/MapIcons/19.png +0 -0
- {foxapi-1.9.0 → foxapi-2.1.0}/foxapi/Images/MapIcons/20.png +0 -0
- {foxapi-1.9.0 → foxapi-2.1.0}/foxapi/Images/MapIcons/21.png +0 -0
- {foxapi-1.9.0 → foxapi-2.1.0}/foxapi/Images/MapIcons/22.png +0 -0
- {foxapi-1.9.0 → foxapi-2.1.0}/foxapi/Images/MapIcons/23.png +0 -0
- {foxapi-1.9.0 → foxapi-2.1.0}/foxapi/Images/MapIcons/27.png +0 -0
- {foxapi-1.9.0 → foxapi-2.1.0}/foxapi/Images/MapIcons/28.png +0 -0
- {foxapi-1.9.0 → foxapi-2.1.0}/foxapi/Images/MapIcons/29.png +0 -0
- {foxapi-1.9.0 → foxapi-2.1.0}/foxapi/Images/MapIcons/30.png +0 -0
- {foxapi-1.9.0 → foxapi-2.1.0}/foxapi/Images/MapIcons/32.png +0 -0
- {foxapi-1.9.0 → foxapi-2.1.0}/foxapi/Images/MapIcons/33.png +0 -0
- {foxapi-1.9.0 → foxapi-2.1.0}/foxapi/Images/MapIcons/34.png +0 -0
- {foxapi-1.9.0 → foxapi-2.1.0}/foxapi/Images/MapIcons/35.png +0 -0
- {foxapi-1.9.0 → foxapi-2.1.0}/foxapi/Images/MapIcons/36.png +0 -0
- {foxapi-1.9.0 → foxapi-2.1.0}/foxapi/Images/MapIcons/37.png +0 -0
- {foxapi-1.9.0 → foxapi-2.1.0}/foxapi/Images/MapIcons/38.png +0 -0
- {foxapi-1.9.0 → foxapi-2.1.0}/foxapi/Images/MapIcons/39.png +0 -0
- {foxapi-1.9.0 → foxapi-2.1.0}/foxapi/Images/MapIcons/40.png +0 -0
- {foxapi-1.9.0 → foxapi-2.1.0}/foxapi/Images/MapIcons/41.png +0 -0
- {foxapi-1.9.0 → foxapi-2.1.0}/foxapi/Images/MapIcons/45.png +0 -0
- {foxapi-1.9.0 → foxapi-2.1.0}/foxapi/Images/MapIcons/46.png +0 -0
- {foxapi-1.9.0 → foxapi-2.1.0}/foxapi/Images/MapIcons/47.png +0 -0
- {foxapi-1.9.0 → foxapi-2.1.0}/foxapi/Images/MapIcons/5.png +0 -0
- {foxapi-1.9.0 → foxapi-2.1.0}/foxapi/Images/MapIcons/51.png +0 -0
- {foxapi-1.9.0 → foxapi-2.1.0}/foxapi/Images/MapIcons/52.png +0 -0
- {foxapi-1.9.0 → foxapi-2.1.0}/foxapi/Images/MapIcons/53.png +0 -0
- {foxapi-1.9.0 → foxapi-2.1.0}/foxapi/Images/MapIcons/54.png +0 -0
- {foxapi-1.9.0 → foxapi-2.1.0}/foxapi/Images/MapIcons/56.png +0 -0
- {foxapi-1.9.0 → foxapi-2.1.0}/foxapi/Images/MapIcons/57.png +0 -0
- {foxapi-1.9.0 → foxapi-2.1.0}/foxapi/Images/MapIcons/58.png +0 -0
- {foxapi-1.9.0 → foxapi-2.1.0}/foxapi/Images/MapIcons/59.png +0 -0
- {foxapi-1.9.0 → foxapi-2.1.0}/foxapi/Images/MapIcons/6.png +0 -0
- {foxapi-1.9.0 → foxapi-2.1.0}/foxapi/Images/MapIcons/60.png +0 -0
- {foxapi-1.9.0 → foxapi-2.1.0}/foxapi/Images/MapIcons/61.png +0 -0
- {foxapi-1.9.0 → foxapi-2.1.0}/foxapi/Images/MapIcons/62.png +0 -0
- {foxapi-1.9.0 → foxapi-2.1.0}/foxapi/Images/MapIcons/7.png +0 -0
- {foxapi-1.9.0 → foxapi-2.1.0}/foxapi/Images/MapIcons/70.png +0 -0
- {foxapi-1.9.0 → foxapi-2.1.0}/foxapi/Images/MapIcons/71.png +0 -0
- {foxapi-1.9.0 → foxapi-2.1.0}/foxapi/Images/MapIcons/72.png +0 -0
- {foxapi-1.9.0 → foxapi-2.1.0}/foxapi/Images/MapIcons/75.png +0 -0
- {foxapi-1.9.0 → foxapi-2.1.0}/foxapi/Images/MapIcons/8.png +0 -0
- {foxapi-1.9.0 → foxapi-2.1.0}/foxapi/Images/MapIcons/83.png +0 -0
- {foxapi-1.9.0 → foxapi-2.1.0}/foxapi/Images/MapIcons/84.png +0 -0
- {foxapi-1.9.0 → foxapi-2.1.0}/foxapi/Images/MapIcons/88.png +0 -0
- {foxapi-1.9.0 → foxapi-2.1.0}/foxapi/Images/MapIcons/89.png +0 -0
- {foxapi-1.9.0 → foxapi-2.1.0}/foxapi/Images/MapIcons/9.png +0 -0
- {foxapi-1.9.0 → foxapi-2.1.0}/foxapi/Images/MapIcons/90.png +0 -0
- {foxapi-1.9.0 → foxapi-2.1.0}/foxapi/Images/MapIcons/91.png +0 -0
- {foxapi-1.9.0 → foxapi-2.1.0}/foxapi/Images/MapIcons/92.png +0 -0
- {foxapi-1.9.0 → foxapi-2.1.0}/foxapi/Images/MapIcons/DebugIcon.png +0 -0
- {foxapi-1.9.0 → foxapi-2.1.0}/foxapi/Images/MapIcons/MapIconCivicCenter.png +0 -0
- {foxapi-1.9.0 → foxapi-2.1.0}/foxapi/Images/MapIcons/MapIconHomeBaseHallColonial.png +0 -0
- {foxapi-1.9.0 → foxapi-2.1.0}/foxapi/Images/MapIcons/MapIconHomeBaseHallWarden.png +0 -0
- {foxapi-1.9.0 → foxapi-2.1.0}/foxapi/Images/MapIcons/MapIconScorchedTown.png +0 -0
- {foxapi-1.9.0 → foxapi-2.1.0}/foxapi/Images/MapIcons/MapIconTownHall.png +0 -0
- {foxapi-1.9.0 → foxapi-2.1.0}/foxapi/Images/MapIcons/MapIconVictory.png +0 -0
- {foxapi-1.9.0 → foxapi-2.1.0}/foxapi/Images/MapsHex/FoxholeFestivalMapHex.png +0 -0
- {foxapi-1.9.0 → foxapi-2.1.0}/foxapi/Images/MapsHex/MapAcrithiaHex.png +0 -0
- {foxapi-1.9.0 → foxapi-2.1.0}/foxapi/Images/MapsHex/MapAllodsBightHex.png +0 -0
- {foxapi-1.9.0 → foxapi-2.1.0}/foxapi/Images/MapsHex/MapAshFieldsHex.png +0 -0
- {foxapi-1.9.0 → foxapi-2.1.0}/foxapi/Images/MapsHex/MapBasinSionnachHex.png +0 -0
- {foxapi-1.9.0 → foxapi-2.1.0}/foxapi/Images/MapsHex/MapCallahansPassageHex.png +0 -0
- {foxapi-1.9.0 → foxapi-2.1.0}/foxapi/Images/MapsHex/MapCallumsCapeHex.png +0 -0
- {foxapi-1.9.0 → foxapi-2.1.0}/foxapi/Images/MapsHex/MapClahstraHex.png +0 -0
- {foxapi-1.9.0 → foxapi-2.1.0}/foxapi/Images/MapsHex/MapClansheadValleyHex.png +0 -0
- {foxapi-1.9.0 → foxapi-2.1.0}/foxapi/Images/MapsHex/MapDeadLandsHex.png +0 -0
- {foxapi-1.9.0 → foxapi-2.1.0}/foxapi/Images/MapsHex/MapDrownedValeHex.png +0 -0
- {foxapi-1.9.0 → foxapi-2.1.0}/foxapi/Images/MapsHex/MapEndlessShoreHex.png +0 -0
- {foxapi-1.9.0 → foxapi-2.1.0}/foxapi/Images/MapsHex/MapFarranacCoastHex.png +0 -0
- {foxapi-1.9.0 → foxapi-2.1.0}/foxapi/Images/MapsHex/MapFishermansRowHex.png +0 -0
- {foxapi-1.9.0 → foxapi-2.1.0}/foxapi/Images/MapsHex/MapGodcroftsHex.png +0 -0
- {foxapi-1.9.0 → foxapi-2.1.0}/foxapi/Images/MapsHex/MapGreatMarchHex.png +0 -0
- {foxapi-1.9.0 → foxapi-2.1.0}/foxapi/Images/MapsHex/MapGutterHex.png +0 -0
- {foxapi-1.9.0 → foxapi-2.1.0}/foxapi/Images/MapsHex/MapHeartlandsHex.png +0 -0
- {foxapi-1.9.0 → foxapi-2.1.0}/foxapi/Images/MapsHex/MapHomeRegionC.png +0 -0
- {foxapi-1.9.0 → foxapi-2.1.0}/foxapi/Images/MapsHex/MapHomeRegionW.png +0 -0
- {foxapi-1.9.0 → foxapi-2.1.0}/foxapi/Images/MapsHex/MapHowlCountyHex.png +0 -0
- {foxapi-1.9.0 → foxapi-2.1.0}/foxapi/Images/MapsHex/MapKalokaiHex.png +0 -0
- {foxapi-1.9.0 → foxapi-2.1.0}/foxapi/Images/MapsHex/MapKingsCageHex.png +0 -0
- {foxapi-1.9.0 → foxapi-2.1.0}/foxapi/Images/MapsHex/MapKuuraStrandHex.png +0 -0
- {foxapi-1.9.0 → foxapi-2.1.0}/foxapi/Images/MapsHex/MapLinnMercyHex.png +0 -0
- {foxapi-1.9.0 → foxapi-2.1.0}/foxapi/Images/MapsHex/MapLochMorHex.png +0 -0
- {foxapi-1.9.0 → foxapi-2.1.0}/foxapi/Images/MapsHex/MapLykosIsleHex.png +0 -0
- {foxapi-1.9.0 → foxapi-2.1.0}/foxapi/Images/MapsHex/MapMarbanHollowHex.png +0 -0
- {foxapi-1.9.0 → foxapi-2.1.0}/foxapi/Images/MapsHex/MapMooringCountyHex.png +0 -0
- {foxapi-1.9.0 → foxapi-2.1.0}/foxapi/Images/MapsHex/MapMorgensCrossingHex.png +0 -0
- {foxapi-1.9.0 → foxapi-2.1.0}/foxapi/Images/MapsHex/MapNevishLineHex.png +0 -0
- {foxapi-1.9.0 → foxapi-2.1.0}/foxapi/Images/MapsHex/MapOarbreakerHex.png +0 -0
- {foxapi-1.9.0 → foxapi-2.1.0}/foxapi/Images/MapsHex/MapOlavisWakeHex.png +0 -0
- {foxapi-1.9.0 → foxapi-2.1.0}/foxapi/Images/MapsHex/MapOnyxHex.png +0 -0
- {foxapi-1.9.0 → foxapi-2.1.0}/foxapi/Images/MapsHex/MapOriginHex.png +0 -0
- {foxapi-1.9.0 → foxapi-2.1.0}/foxapi/Images/MapsHex/MapPalantineBermHex.png +0 -0
- {foxapi-1.9.0 → foxapi-2.1.0}/foxapi/Images/MapsHex/MapPariPeakHex.png +0 -0
- {foxapi-1.9.0 → foxapi-2.1.0}/foxapi/Images/MapsHex/MapPipersEnclaveHex.png +0 -0
- {foxapi-1.9.0 → foxapi-2.1.0}/foxapi/Images/MapsHex/MapReachingTrailHex.png +0 -0
- {foxapi-1.9.0 → foxapi-2.1.0}/foxapi/Images/MapsHex/MapReaversPassHex.png +0 -0
- {foxapi-1.9.0 → foxapi-2.1.0}/foxapi/Images/MapsHex/MapRedRiverHex.png +0 -0
- {foxapi-1.9.0 → foxapi-2.1.0}/foxapi/Images/MapsHex/MapSableportHex.png +0 -0
- {foxapi-1.9.0 → foxapi-2.1.0}/foxapi/Images/MapsHex/MapShackledChasmHex.png +0 -0
- {foxapi-1.9.0 → foxapi-2.1.0}/foxapi/Images/MapsHex/MapSpeakingWoodsHex.png +0 -0
- {foxapi-1.9.0 → foxapi-2.1.0}/foxapi/Images/MapsHex/MapStemaLandingHex.png +0 -0
- {foxapi-1.9.0 → foxapi-2.1.0}/foxapi/Images/MapsHex/MapStlicanShelfHex.png +0 -0
- {foxapi-1.9.0 → foxapi-2.1.0}/foxapi/Images/MapsHex/MapStonecradleHex.png +0 -0
- {foxapi-1.9.0 → foxapi-2.1.0}/foxapi/Images/MapsHex/MapTempestIslandHex.png +0 -0
- {foxapi-1.9.0 → foxapi-2.1.0}/foxapi/Images/MapsHex/MapTerminusHex.png +0 -0
- {foxapi-1.9.0 → foxapi-2.1.0}/foxapi/Images/MapsHex/MapTheFingersHex.png +0 -0
- {foxapi-1.9.0 → foxapi-2.1.0}/foxapi/Images/MapsHex/MapTyrantFoothillsHex.png +0 -0
- {foxapi-1.9.0 → foxapi-2.1.0}/foxapi/Images/MapsHex/MapUmbralWildwoodHex.png +0 -0
- {foxapi-1.9.0 → foxapi-2.1.0}/foxapi/Images/MapsHex/MapViperPitHex.png +0 -0
- {foxapi-1.9.0 → foxapi-2.1.0}/foxapi/Images/MapsHex/MapWeatheredExpanseHex.png +0 -0
- {foxapi-1.9.0 → foxapi-2.1.0}/foxapi/Images/MapsHex/MapWestgateHex.png +0 -0
- {foxapi-1.9.0 → foxapi-2.1.0}/foxapi/Images/MapsHex/MapWrestaHex.png +0 -0
- {foxapi-1.9.0 → foxapi-2.1.0}/foxapi.egg-info/dependency_links.txt +0 -0
- {foxapi-1.9.0 → foxapi-2.1.0}/foxapi.egg-info/requires.txt +0 -0
- {foxapi-1.9.0 → foxapi-2.1.0}/foxapi.egg-info/top_level.txt +0 -0
- {foxapi-1.9.0 → foxapi-2.1.0}/setup.cfg +0 -0
- {foxapi-1.9.0 → foxapi-2.1.0}/setup.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: foxapi
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 2.1.0
|
|
4
4
|
Summary: A wrapper for the foxhole API
|
|
5
5
|
Home-page: https://github.com/ThePhoenix78/FoxAPI
|
|
6
6
|
Download-URL: https://github.com/ThePhoenix78/FoxAPI/tarball/master
|
|
@@ -26,7 +26,7 @@ pip install foxapi
|
|
|
26
26
|
|
|
27
27
|
`FoxAPI` is a wrapper for the Official Foxhole API. It provides methods to interact with various endpoints related to maps, war data, dynamic/static map states, and more. The client supports data caching and etags natively to avoid overloading the Foxhole servers.
|
|
28
28
|
|
|
29
|
-
If you are new to the developer world
|
|
29
|
+
If you are new to the developer world or just like coding, it's the perfect tool!
|
|
30
30
|
|
|
31
31
|
Also, if you work with discord.py or any asynchronous API, this tool might be useful as well since it support async methods natively as well as synchronous
|
|
32
32
|
|
|
@@ -86,28 +86,28 @@ get_data(endpoint: str, session: aiohttp.ClientSession | None = None, etag: str
|
|
|
86
86
|
### Map and War Data
|
|
87
87
|
|
|
88
88
|
```py
|
|
89
|
-
get_maps(use_cache: bool = True, session: aiohttp.ClientSession | None = None) -> list
|
|
89
|
+
get_maps(use_cache: bool = True, session: aiohttp.ClientSession | None = None) -> list[str]
|
|
90
90
|
```
|
|
91
91
|
- Retrieves a list of available hexagons (maps) in the game world.
|
|
92
92
|
|
|
93
93
|
```py
|
|
94
|
-
get_war(use_cache: bool = False, session: aiohttp.ClientSession | None = None) ->
|
|
94
|
+
get_war(use_cache: bool = False, session: aiohttp.ClientSession | None = None) -> WarObject
|
|
95
95
|
```
|
|
96
96
|
- Retrieves the current war state (war data).
|
|
97
97
|
|
|
98
98
|
```py
|
|
99
|
-
get_static(hexagon: str, use_cache: bool = False, session: aiohttp.ClientSession | None = None) ->
|
|
99
|
+
get_static(hexagon: str, use_cache: bool = False, session: aiohttp.ClientSession | None = None) -> SDObject
|
|
100
100
|
```
|
|
101
101
|
|
|
102
102
|
- Retrieves the static data for the specified hexagon.
|
|
103
103
|
|
|
104
104
|
```py
|
|
105
|
-
get_dynamic(hexagon: str, use_cache: bool = False, session: aiohttp.ClientSession | None = None) ->
|
|
105
|
+
get_dynamic(hexagon: str, use_cache: bool = False, session: aiohttp.ClientSession | None = None) -> SDObject
|
|
106
106
|
```
|
|
107
107
|
- Retrieves the dynamic data for the specified hexagon.
|
|
108
108
|
|
|
109
109
|
```py
|
|
110
|
-
get_war_report(hexagon: str, use_cache: bool = False, session: aiohttp.ClientSession | None = None) ->
|
|
110
|
+
get_war_report(hexagon: str, use_cache: bool = False, session: aiohttp.ClientSession | None = None) -> WarReportObject
|
|
111
111
|
```
|
|
112
112
|
- Retrieves the war report for the specified hexagon.
|
|
113
113
|
|
|
@@ -126,7 +126,7 @@ calc_distance(x1: float, y1: float, x2: float, y2: float) -> float
|
|
|
126
126
|
- Calculates the Euclidean distance between two points on the map.
|
|
127
127
|
|
|
128
128
|
```py
|
|
129
|
-
get_captured_towns(hexagon: str = None, dynamic:
|
|
129
|
+
get_captured_towns(hexagon: str = None, dynamic: SDObject = None, static: SDObject = None, session: aiohttp.ClientSession | None = None) -> dict
|
|
130
130
|
```
|
|
131
131
|
- Retrieves the captured towns for a given hexagon based on dynamic and static data.
|
|
132
132
|
|
|
@@ -137,14 +137,15 @@ load_hexagon_map(hexagon: str) -> pillow.Image
|
|
|
137
137
|
- Loads the PNG map for the specified hexagon.
|
|
138
138
|
|
|
139
139
|
```py
|
|
140
|
-
make_map_png(hexagon: str, icons: str | list = "all", colored: bool = False, dynamic:
|
|
140
|
+
make_map_png(hexagon: str, icons: str | list = "all", colored: bool = False, dynamic: SDObject = None, static: SDObject = None, force: bool = False, session: aiohttp.ClientSession | None = None) -> pillow.Image
|
|
141
141
|
```
|
|
142
142
|
- Generates a PNG image of the hexagon map with all the icons associated to each faction in their respective colors (included fields and town base). Only public data will be present.
|
|
143
143
|
- colored -> display each region in the team's color
|
|
144
144
|
- icons -> display selected building in their team's color
|
|
145
|
+
- force -> bypass the cache and generate a new map
|
|
145
146
|
|
|
146
147
|
```py
|
|
147
|
-
calculate_death_rate(hexagon: str = None, war_report:
|
|
148
|
+
calculate_death_rate(hexagon: str = None, war_report: WarReportObject = None, session: aiohttp.ClientSession | None = None): -> dict
|
|
148
149
|
```
|
|
149
150
|
- calculate the death rate between the first launch and the current one
|
|
150
151
|
|
|
@@ -209,30 +210,73 @@ asyncio.run(main())
|
|
|
209
210
|
## Objects
|
|
210
211
|
|
|
211
212
|
```python
|
|
212
|
-
class Task:
|
|
213
|
-
def __init__(self, function: callable, args: any = "no_args", result: any = None):
|
|
214
|
-
self.function: callable = function
|
|
215
|
-
self.args: any = args
|
|
216
|
-
self.result: any = result
|
|
217
|
-
|
|
218
|
-
|
|
219
213
|
class APIResponse:
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
self.is_cache: bool = is_cache
|
|
214
|
+
headers: dict
|
|
215
|
+
json: dict
|
|
216
|
+
status_code: int
|
|
217
|
+
hexagon: str
|
|
218
|
+
is_cache: bool
|
|
226
219
|
|
|
227
220
|
|
|
228
221
|
class HexagonObject:
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
222
|
+
hexagon: str
|
|
223
|
+
war_report: WarReportObject
|
|
224
|
+
static: SDObject
|
|
225
|
+
dynamic: SDObject
|
|
226
|
+
captured_towns: dict
|
|
227
|
+
casualty_rate: dict
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
class WarObject:
|
|
231
|
+
warId: str
|
|
232
|
+
warNumber: int
|
|
233
|
+
winner: str
|
|
234
|
+
conquestStartTime: str
|
|
235
|
+
conquestEndTime: str
|
|
236
|
+
resistanceStartTime: str
|
|
237
|
+
scheduledConquestEndTime: str
|
|
238
|
+
requiredVictoryTowns: str
|
|
239
|
+
shortRequiredVictoryTowns: str
|
|
240
|
+
response: APIResponse
|
|
241
|
+
|
|
242
|
+
|
|
243
|
+
class WarReportObject:
|
|
244
|
+
totalEnlistments: int
|
|
245
|
+
colonialCasualties: int
|
|
246
|
+
wardenCasualties: int
|
|
247
|
+
dayOfWar: int
|
|
248
|
+
version: int
|
|
249
|
+
response: APIResponse
|
|
250
|
+
|
|
251
|
+
|
|
252
|
+
class MapItemsObject:
|
|
253
|
+
teamId: str
|
|
254
|
+
iconType: int
|
|
255
|
+
x: float
|
|
256
|
+
y: float
|
|
257
|
+
flags: int
|
|
258
|
+
viewDirection: int
|
|
259
|
+
|
|
260
|
+
|
|
261
|
+
class MapTextItemsObject:
|
|
262
|
+
text: str
|
|
263
|
+
x: float
|
|
264
|
+
y: float
|
|
265
|
+
mapMarkerType: str
|
|
266
|
+
|
|
267
|
+
|
|
268
|
+
class SDObject:
|
|
269
|
+
regionId: int
|
|
270
|
+
scorchedVictoryTowns: int
|
|
271
|
+
|
|
272
|
+
mapItems: list[MapItemsObject]
|
|
273
|
+
mapItemsC: list[MapItemsObject]
|
|
274
|
+
mapItemsW: list[MapItemsObject]
|
|
275
|
+
mapTextItems: list[MapTextItemsObject]
|
|
276
|
+
|
|
277
|
+
lastUpdated: int
|
|
278
|
+
version: int
|
|
279
|
+
response: APIResponse
|
|
236
280
|
```
|
|
237
281
|
|
|
238
282
|
|
|
@@ -254,12 +298,12 @@ fox = FoxAPI(shard="1")
|
|
|
254
298
|
def function(hexagon: str = "DeadLandsHex"):
|
|
255
299
|
# Get the list of available hexagons (maps) and state of the current war
|
|
256
300
|
maps: list = fox.get_maps_sync()
|
|
257
|
-
war:
|
|
301
|
+
war: WarObject = fox.get_war_sync()
|
|
258
302
|
|
|
259
303
|
# Retrieve data for a specific hexagon
|
|
260
|
-
dynamic_data:
|
|
261
|
-
static_data:
|
|
262
|
-
war_report:
|
|
304
|
+
dynamic_data: SDObject = fox.get_dynamic_sync(hexagon)
|
|
305
|
+
static_data: SDObject = fox.get_static_sync(hexagon)
|
|
306
|
+
war_report: WarReportObject = fox.get_war_report_sync(hexagon)
|
|
263
307
|
|
|
264
308
|
# Create a map PNG for a hexagon with building informations on it
|
|
265
309
|
map_image = fox.make_map_png_sync(hexagon)
|
|
@@ -274,12 +318,12 @@ def function(hexagon: str = "DeadLandsHex"):
|
|
|
274
318
|
async def function(hexagon: str = "DeadLandsHex"):
|
|
275
319
|
# Get the list of available hexagons (maps) and state of the current war
|
|
276
320
|
maps: list = await fox.get_maps()
|
|
277
|
-
war:
|
|
321
|
+
war: WarObject = await fox.get_war()
|
|
278
322
|
|
|
279
323
|
# Retrieve data for a specific hexagon
|
|
280
|
-
dynamic_data:
|
|
281
|
-
static_data:
|
|
282
|
-
war_report:
|
|
324
|
+
dynamic_data: SDObject = await fox.get_dynamic(hexagon)
|
|
325
|
+
static_data: SDObject = await fox.get_static(hexagon)
|
|
326
|
+
war_report: WarReportObject = await fox.get_war_report(hexagon)
|
|
283
327
|
|
|
284
328
|
# Create a map PNG for a hexagon with building informations on it
|
|
285
329
|
map_image = await fox.make_map_png(hexagon)
|
|
@@ -10,7 +10,7 @@ pip install foxapi
|
|
|
10
10
|
|
|
11
11
|
`FoxAPI` is a wrapper for the Official Foxhole API. It provides methods to interact with various endpoints related to maps, war data, dynamic/static map states, and more. The client supports data caching and etags natively to avoid overloading the Foxhole servers.
|
|
12
12
|
|
|
13
|
-
If you are new to the developer world
|
|
13
|
+
If you are new to the developer world or just like coding, it's the perfect tool!
|
|
14
14
|
|
|
15
15
|
Also, if you work with discord.py or any asynchronous API, this tool might be useful as well since it support async methods natively as well as synchronous
|
|
16
16
|
|
|
@@ -70,28 +70,28 @@ get_data(endpoint: str, session: aiohttp.ClientSession | None = None, etag: str
|
|
|
70
70
|
### Map and War Data
|
|
71
71
|
|
|
72
72
|
```py
|
|
73
|
-
get_maps(use_cache: bool = True, session: aiohttp.ClientSession | None = None) -> list
|
|
73
|
+
get_maps(use_cache: bool = True, session: aiohttp.ClientSession | None = None) -> list[str]
|
|
74
74
|
```
|
|
75
75
|
- Retrieves a list of available hexagons (maps) in the game world.
|
|
76
76
|
|
|
77
77
|
```py
|
|
78
|
-
get_war(use_cache: bool = False, session: aiohttp.ClientSession | None = None) ->
|
|
78
|
+
get_war(use_cache: bool = False, session: aiohttp.ClientSession | None = None) -> WarObject
|
|
79
79
|
```
|
|
80
80
|
- Retrieves the current war state (war data).
|
|
81
81
|
|
|
82
82
|
```py
|
|
83
|
-
get_static(hexagon: str, use_cache: bool = False, session: aiohttp.ClientSession | None = None) ->
|
|
83
|
+
get_static(hexagon: str, use_cache: bool = False, session: aiohttp.ClientSession | None = None) -> SDObject
|
|
84
84
|
```
|
|
85
85
|
|
|
86
86
|
- Retrieves the static data for the specified hexagon.
|
|
87
87
|
|
|
88
88
|
```py
|
|
89
|
-
get_dynamic(hexagon: str, use_cache: bool = False, session: aiohttp.ClientSession | None = None) ->
|
|
89
|
+
get_dynamic(hexagon: str, use_cache: bool = False, session: aiohttp.ClientSession | None = None) -> SDObject
|
|
90
90
|
```
|
|
91
91
|
- Retrieves the dynamic data for the specified hexagon.
|
|
92
92
|
|
|
93
93
|
```py
|
|
94
|
-
get_war_report(hexagon: str, use_cache: bool = False, session: aiohttp.ClientSession | None = None) ->
|
|
94
|
+
get_war_report(hexagon: str, use_cache: bool = False, session: aiohttp.ClientSession | None = None) -> WarReportObject
|
|
95
95
|
```
|
|
96
96
|
- Retrieves the war report for the specified hexagon.
|
|
97
97
|
|
|
@@ -110,7 +110,7 @@ calc_distance(x1: float, y1: float, x2: float, y2: float) -> float
|
|
|
110
110
|
- Calculates the Euclidean distance between two points on the map.
|
|
111
111
|
|
|
112
112
|
```py
|
|
113
|
-
get_captured_towns(hexagon: str = None, dynamic:
|
|
113
|
+
get_captured_towns(hexagon: str = None, dynamic: SDObject = None, static: SDObject = None, session: aiohttp.ClientSession | None = None) -> dict
|
|
114
114
|
```
|
|
115
115
|
- Retrieves the captured towns for a given hexagon based on dynamic and static data.
|
|
116
116
|
|
|
@@ -121,14 +121,15 @@ load_hexagon_map(hexagon: str) -> pillow.Image
|
|
|
121
121
|
- Loads the PNG map for the specified hexagon.
|
|
122
122
|
|
|
123
123
|
```py
|
|
124
|
-
make_map_png(hexagon: str, icons: str | list = "all", colored: bool = False, dynamic:
|
|
124
|
+
make_map_png(hexagon: str, icons: str | list = "all", colored: bool = False, dynamic: SDObject = None, static: SDObject = None, force: bool = False, session: aiohttp.ClientSession | None = None) -> pillow.Image
|
|
125
125
|
```
|
|
126
126
|
- Generates a PNG image of the hexagon map with all the icons associated to each faction in their respective colors (included fields and town base). Only public data will be present.
|
|
127
127
|
- colored -> display each region in the team's color
|
|
128
128
|
- icons -> display selected building in their team's color
|
|
129
|
+
- force -> bypass the cache and generate a new map
|
|
129
130
|
|
|
130
131
|
```py
|
|
131
|
-
calculate_death_rate(hexagon: str = None, war_report:
|
|
132
|
+
calculate_death_rate(hexagon: str = None, war_report: WarReportObject = None, session: aiohttp.ClientSession | None = None): -> dict
|
|
132
133
|
```
|
|
133
134
|
- calculate the death rate between the first launch and the current one
|
|
134
135
|
|
|
@@ -193,30 +194,73 @@ asyncio.run(main())
|
|
|
193
194
|
## Objects
|
|
194
195
|
|
|
195
196
|
```python
|
|
196
|
-
class Task:
|
|
197
|
-
def __init__(self, function: callable, args: any = "no_args", result: any = None):
|
|
198
|
-
self.function: callable = function
|
|
199
|
-
self.args: any = args
|
|
200
|
-
self.result: any = result
|
|
201
|
-
|
|
202
|
-
|
|
203
197
|
class APIResponse:
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
self.is_cache: bool = is_cache
|
|
198
|
+
headers: dict
|
|
199
|
+
json: dict
|
|
200
|
+
status_code: int
|
|
201
|
+
hexagon: str
|
|
202
|
+
is_cache: bool
|
|
210
203
|
|
|
211
204
|
|
|
212
205
|
class HexagonObject:
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
206
|
+
hexagon: str
|
|
207
|
+
war_report: WarReportObject
|
|
208
|
+
static: SDObject
|
|
209
|
+
dynamic: SDObject
|
|
210
|
+
captured_towns: dict
|
|
211
|
+
casualty_rate: dict
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
class WarObject:
|
|
215
|
+
warId: str
|
|
216
|
+
warNumber: int
|
|
217
|
+
winner: str
|
|
218
|
+
conquestStartTime: str
|
|
219
|
+
conquestEndTime: str
|
|
220
|
+
resistanceStartTime: str
|
|
221
|
+
scheduledConquestEndTime: str
|
|
222
|
+
requiredVictoryTowns: str
|
|
223
|
+
shortRequiredVictoryTowns: str
|
|
224
|
+
response: APIResponse
|
|
225
|
+
|
|
226
|
+
|
|
227
|
+
class WarReportObject:
|
|
228
|
+
totalEnlistments: int
|
|
229
|
+
colonialCasualties: int
|
|
230
|
+
wardenCasualties: int
|
|
231
|
+
dayOfWar: int
|
|
232
|
+
version: int
|
|
233
|
+
response: APIResponse
|
|
234
|
+
|
|
235
|
+
|
|
236
|
+
class MapItemsObject:
|
|
237
|
+
teamId: str
|
|
238
|
+
iconType: int
|
|
239
|
+
x: float
|
|
240
|
+
y: float
|
|
241
|
+
flags: int
|
|
242
|
+
viewDirection: int
|
|
243
|
+
|
|
244
|
+
|
|
245
|
+
class MapTextItemsObject:
|
|
246
|
+
text: str
|
|
247
|
+
x: float
|
|
248
|
+
y: float
|
|
249
|
+
mapMarkerType: str
|
|
250
|
+
|
|
251
|
+
|
|
252
|
+
class SDObject:
|
|
253
|
+
regionId: int
|
|
254
|
+
scorchedVictoryTowns: int
|
|
255
|
+
|
|
256
|
+
mapItems: list[MapItemsObject]
|
|
257
|
+
mapItemsC: list[MapItemsObject]
|
|
258
|
+
mapItemsW: list[MapItemsObject]
|
|
259
|
+
mapTextItems: list[MapTextItemsObject]
|
|
260
|
+
|
|
261
|
+
lastUpdated: int
|
|
262
|
+
version: int
|
|
263
|
+
response: APIResponse
|
|
220
264
|
```
|
|
221
265
|
|
|
222
266
|
|
|
@@ -238,12 +282,12 @@ fox = FoxAPI(shard="1")
|
|
|
238
282
|
def function(hexagon: str = "DeadLandsHex"):
|
|
239
283
|
# Get the list of available hexagons (maps) and state of the current war
|
|
240
284
|
maps: list = fox.get_maps_sync()
|
|
241
|
-
war:
|
|
285
|
+
war: WarObject = fox.get_war_sync()
|
|
242
286
|
|
|
243
287
|
# Retrieve data for a specific hexagon
|
|
244
|
-
dynamic_data:
|
|
245
|
-
static_data:
|
|
246
|
-
war_report:
|
|
288
|
+
dynamic_data: SDObject = fox.get_dynamic_sync(hexagon)
|
|
289
|
+
static_data: SDObject = fox.get_static_sync(hexagon)
|
|
290
|
+
war_report: WarReportObject = fox.get_war_report_sync(hexagon)
|
|
247
291
|
|
|
248
292
|
# Create a map PNG for a hexagon with building informations on it
|
|
249
293
|
map_image = fox.make_map_png_sync(hexagon)
|
|
@@ -258,12 +302,12 @@ def function(hexagon: str = "DeadLandsHex"):
|
|
|
258
302
|
async def function(hexagon: str = "DeadLandsHex"):
|
|
259
303
|
# Get the list of available hexagons (maps) and state of the current war
|
|
260
304
|
maps: list = await fox.get_maps()
|
|
261
|
-
war:
|
|
305
|
+
war: WarObject = await fox.get_war()
|
|
262
306
|
|
|
263
307
|
# Retrieve data for a specific hexagon
|
|
264
|
-
dynamic_data:
|
|
265
|
-
static_data:
|
|
266
|
-
war_report:
|
|
308
|
+
dynamic_data: SDObject = await fox.get_dynamic(hexagon)
|
|
309
|
+
static_data: SDObject = await fox.get_static(hexagon)
|
|
310
|
+
war_report: WarReportObject = await fox.get_war_report(hexagon)
|
|
267
311
|
|
|
268
312
|
# Create a map PNG for a hexagon with building informations on it
|
|
269
313
|
map_image = await fox.make_map_png(hexagon)
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
from .foxapi import FoxAPI
|
|
2
2
|
from .utils import HexagonObject, FoxAPIError, HexagonError, EndpointError, APIResponse, Task, _images_relations, _map_flags
|
|
3
|
+
from .objects import WarObject, WarReportObject, SDObject
|
|
3
4
|
|
|
4
5
|
import requests, json
|
|
5
6
|
|
|
@@ -9,7 +10,7 @@ __author__ = 'ThePhoenix78'
|
|
|
9
10
|
__license__ = 'MIT'
|
|
10
11
|
__copyright__ = 'Copyright 2024-2026 ThePhoenix78'
|
|
11
12
|
__url__ = 'https://github.com/ThePhoenix78/FoxAPI'
|
|
12
|
-
__newest__ = __version__ = '1.
|
|
13
|
+
__newest__ = __version__ = '2.1.0'
|
|
13
14
|
|
|
14
15
|
|
|
15
16
|
try:
|
|
@@ -24,4 +25,4 @@ finally:
|
|
|
24
25
|
if __version__ < __newest__:
|
|
25
26
|
print(f"New version of {__title__} available: {__newest__} (Using {__version__})")
|
|
26
27
|
else:
|
|
27
|
-
print(f"version : {__version__}")
|
|
28
|
+
print(f"version : {__version__}")
|