foxapi 1.0.0__tar.gz → 1.0.5__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.0.0 → foxapi-1.0.5}/LICENSE +1 -1
- {foxapi-1.0.0 → foxapi-1.0.5}/PKG-INFO +21 -5
- {foxapi-1.0.0 → foxapi-1.0.5}/README.md +20 -4
- {foxapi-1.0.0 → foxapi-1.0.5}/foxapi/foxapi.py +6 -2
- {foxapi-1.0.0 → foxapi-1.0.5}/foxapi.egg-info/PKG-INFO +21 -5
- {foxapi-1.0.0 → foxapi-1.0.5}/setup.py +1 -1
- {foxapi-1.0.0 → foxapi-1.0.5}/foxapi/__init__.py +0 -0
- {foxapi-1.0.0 → foxapi-1.0.5}/foxapi/utils.py +0 -0
- {foxapi-1.0.0 → foxapi-1.0.5}/foxapi.egg-info/SOURCES.txt +0 -0
- {foxapi-1.0.0 → foxapi-1.0.5}/foxapi.egg-info/dependency_links.txt +0 -0
- {foxapi-1.0.0 → foxapi-1.0.5}/foxapi.egg-info/requires.txt +0 -0
- {foxapi-1.0.0 → foxapi-1.0.5}/foxapi.egg-info/top_level.txt +0 -0
- {foxapi-1.0.0 → foxapi-1.0.5}/setup.cfg +0 -0
|
@@ -9,7 +9,7 @@ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
9
9
|
copies of the Software, and to permit persons to whom the Software is
|
|
10
10
|
furnished to do so, subject to the following conditions:
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
You have to reference this library or my work if you use it, and no commercial use is permitted
|
|
13
13
|
|
|
14
14
|
The above copyright notice and this permission notice shall be included in all
|
|
15
15
|
copies or substantial portions of the Software.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: foxapi
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.5
|
|
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
|
|
@@ -18,6 +18,14 @@ Requires-Dist: pillow
|
|
|
18
18
|
|
|
19
19
|
# FoxAPI Documentation
|
|
20
20
|
|
|
21
|
+
#### If you use the PyPi version, you might need to download manually the `Images` folder in the [github](https://github.com/ThePhoenix78/FoxAPI/tree/main/foxapi) and pass it as an argument like `fox = FoxAPI(image_dir="Images")`
|
|
22
|
+
|
|
23
|
+
## Installation
|
|
24
|
+
```bash
|
|
25
|
+
pip install foxapi
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
|
|
21
29
|
`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.
|
|
22
30
|
|
|
23
31
|
If you are new to the developer world (or lazy like me), it's the perfect tool!
|
|
@@ -27,13 +35,14 @@ Also, if you work with discord.py or any asynchronous API, this tool might be us
|
|
|
27
35
|
|
|
28
36
|
## Table of Contents
|
|
29
37
|
- [Dependencies](#dependencies)
|
|
38
|
+
- [Wrapper](#wrapper)
|
|
30
39
|
- [Methods](#methods)
|
|
31
40
|
- [API Interaction](#api-interaction)
|
|
32
41
|
- [Map and War Data](#map-and-war-data)
|
|
33
42
|
- [Hexagon Operations](#hexagon-operations)
|
|
34
43
|
- [Listener Functions](#listener-functions)
|
|
35
44
|
- [Error Handling](#error-handling)
|
|
36
|
-
- [Objects](#
|
|
45
|
+
- [Objects](#objects)
|
|
37
46
|
- [Example Usage](#example-usage)
|
|
38
47
|
|
|
39
48
|
## Dependencies
|
|
@@ -42,6 +51,13 @@ Also, if you work with discord.py or any asynchronous API, this tool might be us
|
|
|
42
51
|
pip install pillow requests
|
|
43
52
|
```
|
|
44
53
|
|
|
54
|
+
## Wrapper
|
|
55
|
+
|
|
56
|
+
```python
|
|
57
|
+
class FoxAPI(image_dir: str = None, safe_mode: bool = True)
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
|
|
45
61
|
## Methods
|
|
46
62
|
|
|
47
63
|
### API Interaction (async)
|
|
@@ -92,7 +108,7 @@ Also, if you work with discord.py or any asynchronous API, this tool might be us
|
|
|
92
108
|
- **make_map_png(hexagon: str, dynamic: dict = None, static: dict = None) -> pillow.Image**
|
|
93
109
|
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.
|
|
94
110
|
|
|
95
|
-
- **calculate_death_rate(
|
|
111
|
+
- **calculate_death_rate(hexagon: str = None, war_report: dict = None): -> dict**
|
|
96
112
|
calculate the death rate between the first launch and the current one
|
|
97
113
|
|
|
98
114
|
### Listener Functions
|
|
@@ -142,11 +158,11 @@ from foxapi import FoxAPI
|
|
|
142
158
|
# Initialize the API client in safe mode
|
|
143
159
|
|
|
144
160
|
# if you are a developer and plane to use the exact hexagons name
|
|
145
|
-
# you can turn the
|
|
161
|
+
# you can turn the safe_mode off, otherwise it will convert
|
|
146
162
|
# api calls and hexagons name into valid ones
|
|
147
163
|
# Ex: deadlands -> DeadLandsHex (Yes, I am *that* lazy)
|
|
148
164
|
|
|
149
|
-
fox = FoxAPI(
|
|
165
|
+
fox = FoxAPI()
|
|
150
166
|
|
|
151
167
|
hexagon: str = "DeadLandsHex"
|
|
152
168
|
|
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# FoxAPI Documentation
|
|
2
2
|
|
|
3
|
+
#### If you use the PyPi version, you might need to download manually the `Images` folder in the [github](https://github.com/ThePhoenix78/FoxAPI/tree/main/foxapi) and pass it as an argument like `fox = FoxAPI(image_dir="Images")`
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
```bash
|
|
7
|
+
pip install foxapi
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
|
|
3
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.
|
|
4
12
|
|
|
5
13
|
If you are new to the developer world (or lazy like me), it's the perfect tool!
|
|
@@ -9,13 +17,14 @@ Also, if you work with discord.py or any asynchronous API, this tool might be us
|
|
|
9
17
|
|
|
10
18
|
## Table of Contents
|
|
11
19
|
- [Dependencies](#dependencies)
|
|
20
|
+
- [Wrapper](#wrapper)
|
|
12
21
|
- [Methods](#methods)
|
|
13
22
|
- [API Interaction](#api-interaction)
|
|
14
23
|
- [Map and War Data](#map-and-war-data)
|
|
15
24
|
- [Hexagon Operations](#hexagon-operations)
|
|
16
25
|
- [Listener Functions](#listener-functions)
|
|
17
26
|
- [Error Handling](#error-handling)
|
|
18
|
-
- [Objects](#
|
|
27
|
+
- [Objects](#objects)
|
|
19
28
|
- [Example Usage](#example-usage)
|
|
20
29
|
|
|
21
30
|
## Dependencies
|
|
@@ -24,6 +33,13 @@ Also, if you work with discord.py or any asynchronous API, this tool might be us
|
|
|
24
33
|
pip install pillow requests
|
|
25
34
|
```
|
|
26
35
|
|
|
36
|
+
## Wrapper
|
|
37
|
+
|
|
38
|
+
```python
|
|
39
|
+
class FoxAPI(image_dir: str = None, safe_mode: bool = True)
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
|
|
27
43
|
## Methods
|
|
28
44
|
|
|
29
45
|
### API Interaction (async)
|
|
@@ -74,7 +90,7 @@ Also, if you work with discord.py or any asynchronous API, this tool might be us
|
|
|
74
90
|
- **make_map_png(hexagon: str, dynamic: dict = None, static: dict = None) -> pillow.Image**
|
|
75
91
|
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.
|
|
76
92
|
|
|
77
|
-
- **calculate_death_rate(
|
|
93
|
+
- **calculate_death_rate(hexagon: str = None, war_report: dict = None): -> dict**
|
|
78
94
|
calculate the death rate between the first launch and the current one
|
|
79
95
|
|
|
80
96
|
### Listener Functions
|
|
@@ -124,11 +140,11 @@ from foxapi import FoxAPI
|
|
|
124
140
|
# Initialize the API client in safe mode
|
|
125
141
|
|
|
126
142
|
# if you are a developer and plane to use the exact hexagons name
|
|
127
|
-
# you can turn the
|
|
143
|
+
# you can turn the safe_mode off, otherwise it will convert
|
|
128
144
|
# api calls and hexagons name into valid ones
|
|
129
145
|
# Ex: deadlands -> DeadLandsHex (Yes, I am *that* lazy)
|
|
130
146
|
|
|
131
|
-
fox = FoxAPI(
|
|
147
|
+
fox = FoxAPI()
|
|
132
148
|
|
|
133
149
|
hexagon: str = "DeadLandsHex"
|
|
134
150
|
|
|
@@ -9,6 +9,7 @@ import threading
|
|
|
9
9
|
import requests
|
|
10
10
|
import aiohttp
|
|
11
11
|
import asyncio
|
|
12
|
+
import pathlib
|
|
12
13
|
import math
|
|
13
14
|
import time
|
|
14
15
|
import os
|
|
@@ -20,11 +21,14 @@ import os
|
|
|
20
21
|
|
|
21
22
|
|
|
22
23
|
class FoxAPI():
|
|
23
|
-
def __init__(self, safe_mode: bool = True):
|
|
24
|
+
def __init__(self, image_dir: str = None, safe_mode: bool = True):
|
|
24
25
|
self.base_api: str = "https://war-service-live.foxholeservices.com/api/worldconquest"
|
|
25
26
|
self.session: requests.Session = requests.Session()
|
|
26
27
|
|
|
27
|
-
|
|
28
|
+
if image_dir is not None:
|
|
29
|
+
self._img_dir: str = pathlib.Path(image_dir)
|
|
30
|
+
else:
|
|
31
|
+
self._img_dir: str = os.path.join(Path(__file__).parent, "Images")
|
|
28
32
|
|
|
29
33
|
self.cache: dict = {}
|
|
30
34
|
self.etag: dict = {}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: foxapi
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.5
|
|
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
|
|
@@ -18,6 +18,14 @@ Requires-Dist: pillow
|
|
|
18
18
|
|
|
19
19
|
# FoxAPI Documentation
|
|
20
20
|
|
|
21
|
+
#### If you use the PyPi version, you might need to download manually the `Images` folder in the [github](https://github.com/ThePhoenix78/FoxAPI/tree/main/foxapi) and pass it as an argument like `fox = FoxAPI(image_dir="Images")`
|
|
22
|
+
|
|
23
|
+
## Installation
|
|
24
|
+
```bash
|
|
25
|
+
pip install foxapi
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
|
|
21
29
|
`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.
|
|
22
30
|
|
|
23
31
|
If you are new to the developer world (or lazy like me), it's the perfect tool!
|
|
@@ -27,13 +35,14 @@ Also, if you work with discord.py or any asynchronous API, this tool might be us
|
|
|
27
35
|
|
|
28
36
|
## Table of Contents
|
|
29
37
|
- [Dependencies](#dependencies)
|
|
38
|
+
- [Wrapper](#wrapper)
|
|
30
39
|
- [Methods](#methods)
|
|
31
40
|
- [API Interaction](#api-interaction)
|
|
32
41
|
- [Map and War Data](#map-and-war-data)
|
|
33
42
|
- [Hexagon Operations](#hexagon-operations)
|
|
34
43
|
- [Listener Functions](#listener-functions)
|
|
35
44
|
- [Error Handling](#error-handling)
|
|
36
|
-
- [Objects](#
|
|
45
|
+
- [Objects](#objects)
|
|
37
46
|
- [Example Usage](#example-usage)
|
|
38
47
|
|
|
39
48
|
## Dependencies
|
|
@@ -42,6 +51,13 @@ Also, if you work with discord.py or any asynchronous API, this tool might be us
|
|
|
42
51
|
pip install pillow requests
|
|
43
52
|
```
|
|
44
53
|
|
|
54
|
+
## Wrapper
|
|
55
|
+
|
|
56
|
+
```python
|
|
57
|
+
class FoxAPI(image_dir: str = None, safe_mode: bool = True)
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
|
|
45
61
|
## Methods
|
|
46
62
|
|
|
47
63
|
### API Interaction (async)
|
|
@@ -92,7 +108,7 @@ Also, if you work with discord.py or any asynchronous API, this tool might be us
|
|
|
92
108
|
- **make_map_png(hexagon: str, dynamic: dict = None, static: dict = None) -> pillow.Image**
|
|
93
109
|
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.
|
|
94
110
|
|
|
95
|
-
- **calculate_death_rate(
|
|
111
|
+
- **calculate_death_rate(hexagon: str = None, war_report: dict = None): -> dict**
|
|
96
112
|
calculate the death rate between the first launch and the current one
|
|
97
113
|
|
|
98
114
|
### Listener Functions
|
|
@@ -142,11 +158,11 @@ from foxapi import FoxAPI
|
|
|
142
158
|
# Initialize the API client in safe mode
|
|
143
159
|
|
|
144
160
|
# if you are a developer and plane to use the exact hexagons name
|
|
145
|
-
# you can turn the
|
|
161
|
+
# you can turn the safe_mode off, otherwise it will convert
|
|
146
162
|
# api calls and hexagons name into valid ones
|
|
147
163
|
# Ex: deadlands -> DeadLandsHex (Yes, I am *that* lazy)
|
|
148
164
|
|
|
149
|
-
fox = FoxAPI(
|
|
165
|
+
fox = FoxAPI()
|
|
150
166
|
|
|
151
167
|
hexagon: str = "DeadLandsHex"
|
|
152
168
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|