foxapi 1.0.6__tar.gz → 1.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.
@@ -1,13 +1,13 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: foxapi
3
- Version: 1.0.6
3
+ Version: 1.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
7
7
  Author: ThePhoenix78
8
8
  Author-email: thephoenix788@gmail.com
9
9
  License: MIT
10
- Keywords: foxhole,foxapi
10
+ Keywords: foxhole,foxapi,foxhole-game
11
11
  Classifier: Programming Language :: Python :: 3
12
12
  Classifier: License :: OSI Approved :: MIT License
13
13
  Classifier: Operating System :: OS Independent
@@ -54,7 +54,7 @@ Also, if you work with discord.py or any asynchronous API, this tool might be us
54
54
  ## Wrapper
55
55
 
56
56
  ```python
57
- class FoxAPI(image_dir: str = None, safe_mode: bool = True)
57
+ class FoxAPI(shard: str = "", image_dir: str = None, safe_mode: bool = True)
58
58
  ```
59
59
 
60
60
 
@@ -64,34 +64,34 @@ class FoxAPI(image_dir: str = None, safe_mode: bool = True)
64
64
 
65
65
  #### Note : all of theses methods are async, to run the synchronous version, add _sync at the end (see API example)
66
66
 
67
- - **get_data(endpoint: str, etag: str = None, cache: bool = False) -> requests.Response**
68
- Fetches data from the specified endpoint with optional caching and ETag support.
67
+ - **get_data(endpoint: str, etag: str = None, use_cache: bool = False) -> APIResponse**
68
+ Fetches data from the specified endpoint, you can choose to use cache instead of sending a request and you can pass ETag.
69
69
 
70
70
  - Parameters:
71
71
  - `endpoint` (str): The API endpoint to call.
72
72
  - `etag` (str, optional): The ETag header for cache validation (not required since managed natively).
73
73
  - `cache` (bool, optional): Whether to use cached data (default: False).
74
74
 
75
- - Returns: The response data from the API as a requests.Response object.
75
+ - Returns: The response data from the API as a APIResponse object.
76
76
 
77
77
  ### Map and War Data
78
78
 
79
- - **get_maps(cache: bool = True) -> list**
79
+ - **get_maps(use_cache: bool = True) -> list**
80
80
  Retrieves a list of available hexagons (maps) in the game world.
81
81
 
82
- - **get_war(cache: bool = False) -> dict**
82
+ - **get_war(use_cache: bool = False) -> dict**
83
83
  Retrieves the current war state (war data).
84
84
 
85
- - **get_static(hexagon: str, cache: bool = False) -> dict**
85
+ - **get_static(hexagon: str, use_cache: bool = False) -> dict**
86
86
  Retrieves the static data for the specified hexagon.
87
87
 
88
- - **get_dynamic(hexagon: str, cache: bool = False) -> dict**
88
+ - **get_dynamic(hexagon: str, use_cache: bool = False) -> dict**
89
89
  Retrieves the dynamic data for the specified hexagon.
90
90
 
91
- - **get_war_report(hexagon: str, cache: bool = False) -> dict**
91
+ - **get_war_report(hexagon: str, use_cache: bool = False) -> dict**
92
92
  Retrieves the war report for the specified hexagon.
93
93
 
94
- - **get_hexagon_data(hexagon: str, cache: bool = False) -> HexagonObject**
94
+ - **get_hexagon_data(hexagon: str, use_cache: bool = False) -> HexagonObject**
95
95
  Retrieves all the data awailable for the specified hexagon.
96
96
 
97
97
  ### Hexagon Operations
@@ -130,12 +130,12 @@ class FoxAPI(image_dir: str = None, safe_mode: bool = True)
130
130
 
131
131
  ```python
132
132
  class APIResponse:
133
- def __init__(self, headers: dict, json: dict, status_code: int, hexagon: str, is_cache: bool):
133
+ def __init__(self, headers: dict, json: dict, status_code: int, hexagon: str, is_use_cache: bool):
134
134
  self.headers: dict = headers
135
135
  self.json: dict = json
136
136
  self.status_code: int = status_code
137
137
  self.hexagon: str = hexagon
138
- self.is_cache: bool = is_cache
138
+ self.is_use_cache: bool = is_cache
139
139
 
140
140
 
141
141
  class HexagonObject:
@@ -162,7 +162,9 @@ from foxapi import FoxAPI
162
162
  # api calls and hexagons name into valid ones
163
163
  # Ex: deadlands -> DeadLandsHex (Yes, I am *that* lazy)
164
164
 
165
- fox = FoxAPI()
165
+ # don't forget to download the image folder https://github.com/ThePhoenix78/FoxAPI/tree/main/foxapi
166
+
167
+ fox = FoxAPI(shard="2", image_dir="Images")
166
168
 
167
169
  hexagon: str = "DeadLandsHex"
168
170
 
@@ -36,7 +36,7 @@ Also, if you work with discord.py or any asynchronous API, this tool might be us
36
36
  ## Wrapper
37
37
 
38
38
  ```python
39
- class FoxAPI(image_dir: str = None, safe_mode: bool = True)
39
+ class FoxAPI(shard: str = "", image_dir: str = None, safe_mode: bool = True)
40
40
  ```
41
41
 
42
42
 
@@ -46,34 +46,34 @@ class FoxAPI(image_dir: str = None, safe_mode: bool = True)
46
46
 
47
47
  #### Note : all of theses methods are async, to run the synchronous version, add _sync at the end (see API example)
48
48
 
49
- - **get_data(endpoint: str, etag: str = None, cache: bool = False) -> requests.Response**
50
- Fetches data from the specified endpoint with optional caching and ETag support.
49
+ - **get_data(endpoint: str, etag: str = None, use_cache: bool = False) -> APIResponse**
50
+ Fetches data from the specified endpoint, you can choose to use cache instead of sending a request and you can pass ETag.
51
51
 
52
52
  - Parameters:
53
53
  - `endpoint` (str): The API endpoint to call.
54
54
  - `etag` (str, optional): The ETag header for cache validation (not required since managed natively).
55
55
  - `cache` (bool, optional): Whether to use cached data (default: False).
56
56
 
57
- - Returns: The response data from the API as a requests.Response object.
57
+ - Returns: The response data from the API as a APIResponse object.
58
58
 
59
59
  ### Map and War Data
60
60
 
61
- - **get_maps(cache: bool = True) -> list**
61
+ - **get_maps(use_cache: bool = True) -> list**
62
62
  Retrieves a list of available hexagons (maps) in the game world.
63
63
 
64
- - **get_war(cache: bool = False) -> dict**
64
+ - **get_war(use_cache: bool = False) -> dict**
65
65
  Retrieves the current war state (war data).
66
66
 
67
- - **get_static(hexagon: str, cache: bool = False) -> dict**
67
+ - **get_static(hexagon: str, use_cache: bool = False) -> dict**
68
68
  Retrieves the static data for the specified hexagon.
69
69
 
70
- - **get_dynamic(hexagon: str, cache: bool = False) -> dict**
70
+ - **get_dynamic(hexagon: str, use_cache: bool = False) -> dict**
71
71
  Retrieves the dynamic data for the specified hexagon.
72
72
 
73
- - **get_war_report(hexagon: str, cache: bool = False) -> dict**
73
+ - **get_war_report(hexagon: str, use_cache: bool = False) -> dict**
74
74
  Retrieves the war report for the specified hexagon.
75
75
 
76
- - **get_hexagon_data(hexagon: str, cache: bool = False) -> HexagonObject**
76
+ - **get_hexagon_data(hexagon: str, use_cache: bool = False) -> HexagonObject**
77
77
  Retrieves all the data awailable for the specified hexagon.
78
78
 
79
79
  ### Hexagon Operations
@@ -112,12 +112,12 @@ class FoxAPI(image_dir: str = None, safe_mode: bool = True)
112
112
 
113
113
  ```python
114
114
  class APIResponse:
115
- def __init__(self, headers: dict, json: dict, status_code: int, hexagon: str, is_cache: bool):
115
+ def __init__(self, headers: dict, json: dict, status_code: int, hexagon: str, is_use_cache: bool):
116
116
  self.headers: dict = headers
117
117
  self.json: dict = json
118
118
  self.status_code: int = status_code
119
119
  self.hexagon: str = hexagon
120
- self.is_cache: bool = is_cache
120
+ self.is_use_cache: bool = is_cache
121
121
 
122
122
 
123
123
  class HexagonObject:
@@ -144,7 +144,9 @@ from foxapi import FoxAPI
144
144
  # api calls and hexagons name into valid ones
145
145
  # Ex: deadlands -> DeadLandsHex (Yes, I am *that* lazy)
146
146
 
147
- fox = FoxAPI()
147
+ # don't forget to download the image folder https://github.com/ThePhoenix78/FoxAPI/tree/main/foxapi
148
+
149
+ fox = FoxAPI(shard="2", image_dir="Images")
148
150
 
149
151
  hexagon: str = "DeadLandsHex"
150
152
 
@@ -21,8 +21,17 @@ import os
21
21
 
22
22
 
23
23
  class FoxAPI():
24
- def __init__(self, image_dir: str = None, safe_mode: bool = True):
25
- self.base_api: str = "https://war-service-live.foxholeservices.com/api/worldconquest"
24
+ def __init__(self, shard: str = "", image_dir: str = None, safe_mode: bool = True):
25
+ if shard in [1, "1"]:
26
+ shard: str = ""
27
+
28
+ elif shard in [2, "2", "-2"]:
29
+ shard: str = "-2"
30
+
31
+ elif shard in [3, "3", "-3"]:
32
+ shard: str = "-3"
33
+
34
+ self.base_api: str = f"https://war-service-live{shard}.foxholeservices.com/api/worldconquest"
26
35
  self.session: requests.Session = requests.Session()
27
36
 
28
37
  if image_dir is not None:
@@ -1,13 +1,13 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: foxapi
3
- Version: 1.0.6
3
+ Version: 1.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
7
7
  Author: ThePhoenix78
8
8
  Author-email: thephoenix788@gmail.com
9
9
  License: MIT
10
- Keywords: foxhole,foxapi
10
+ Keywords: foxhole,foxapi,foxhole-game
11
11
  Classifier: Programming Language :: Python :: 3
12
12
  Classifier: License :: OSI Approved :: MIT License
13
13
  Classifier: Operating System :: OS Independent
@@ -54,7 +54,7 @@ Also, if you work with discord.py or any asynchronous API, this tool might be us
54
54
  ## Wrapper
55
55
 
56
56
  ```python
57
- class FoxAPI(image_dir: str = None, safe_mode: bool = True)
57
+ class FoxAPI(shard: str = "", image_dir: str = None, safe_mode: bool = True)
58
58
  ```
59
59
 
60
60
 
@@ -64,34 +64,34 @@ class FoxAPI(image_dir: str = None, safe_mode: bool = True)
64
64
 
65
65
  #### Note : all of theses methods are async, to run the synchronous version, add _sync at the end (see API example)
66
66
 
67
- - **get_data(endpoint: str, etag: str = None, cache: bool = False) -> requests.Response**
68
- Fetches data from the specified endpoint with optional caching and ETag support.
67
+ - **get_data(endpoint: str, etag: str = None, use_cache: bool = False) -> APIResponse**
68
+ Fetches data from the specified endpoint, you can choose to use cache instead of sending a request and you can pass ETag.
69
69
 
70
70
  - Parameters:
71
71
  - `endpoint` (str): The API endpoint to call.
72
72
  - `etag` (str, optional): The ETag header for cache validation (not required since managed natively).
73
73
  - `cache` (bool, optional): Whether to use cached data (default: False).
74
74
 
75
- - Returns: The response data from the API as a requests.Response object.
75
+ - Returns: The response data from the API as a APIResponse object.
76
76
 
77
77
  ### Map and War Data
78
78
 
79
- - **get_maps(cache: bool = True) -> list**
79
+ - **get_maps(use_cache: bool = True) -> list**
80
80
  Retrieves a list of available hexagons (maps) in the game world.
81
81
 
82
- - **get_war(cache: bool = False) -> dict**
82
+ - **get_war(use_cache: bool = False) -> dict**
83
83
  Retrieves the current war state (war data).
84
84
 
85
- - **get_static(hexagon: str, cache: bool = False) -> dict**
85
+ - **get_static(hexagon: str, use_cache: bool = False) -> dict**
86
86
  Retrieves the static data for the specified hexagon.
87
87
 
88
- - **get_dynamic(hexagon: str, cache: bool = False) -> dict**
88
+ - **get_dynamic(hexagon: str, use_cache: bool = False) -> dict**
89
89
  Retrieves the dynamic data for the specified hexagon.
90
90
 
91
- - **get_war_report(hexagon: str, cache: bool = False) -> dict**
91
+ - **get_war_report(hexagon: str, use_cache: bool = False) -> dict**
92
92
  Retrieves the war report for the specified hexagon.
93
93
 
94
- - **get_hexagon_data(hexagon: str, cache: bool = False) -> HexagonObject**
94
+ - **get_hexagon_data(hexagon: str, use_cache: bool = False) -> HexagonObject**
95
95
  Retrieves all the data awailable for the specified hexagon.
96
96
 
97
97
  ### Hexagon Operations
@@ -130,12 +130,12 @@ class FoxAPI(image_dir: str = None, safe_mode: bool = True)
130
130
 
131
131
  ```python
132
132
  class APIResponse:
133
- def __init__(self, headers: dict, json: dict, status_code: int, hexagon: str, is_cache: bool):
133
+ def __init__(self, headers: dict, json: dict, status_code: int, hexagon: str, is_use_cache: bool):
134
134
  self.headers: dict = headers
135
135
  self.json: dict = json
136
136
  self.status_code: int = status_code
137
137
  self.hexagon: str = hexagon
138
- self.is_cache: bool = is_cache
138
+ self.is_use_cache: bool = is_cache
139
139
 
140
140
 
141
141
  class HexagonObject:
@@ -162,7 +162,9 @@ from foxapi import FoxAPI
162
162
  # api calls and hexagons name into valid ones
163
163
  # Ex: deadlands -> DeadLandsHex (Yes, I am *that* lazy)
164
164
 
165
- fox = FoxAPI()
165
+ # don't forget to download the image folder https://github.com/ThePhoenix78/FoxAPI/tree/main/foxapi
166
+
167
+ fox = FoxAPI(shard="2", image_dir="Images")
166
168
 
167
169
  hexagon: str = "DeadLandsHex"
168
170
 
@@ -1,12 +1,12 @@
1
1
  from setuptools import setup, find_packages
2
- # from BotAmino.__init__ import __version__
2
+
3
3
 
4
4
  with open("README.md", "r") as stream:
5
5
  long_description = stream.read()
6
6
 
7
7
  setup(
8
8
  name='foxapi',
9
- version="1.0.6",
9
+ version="1.1.0",
10
10
  url='https://github.com/ThePhoenix78/FoxAPI',
11
11
  download_url='https://github.com/ThePhoenix78/FoxAPI/tarball/master',
12
12
  license='MIT',
@@ -17,7 +17,8 @@ setup(
17
17
  long_description_content_type='text/markdown',
18
18
  keywords=[
19
19
  'foxhole',
20
- 'foxapi'
20
+ 'foxapi',
21
+ 'foxhole-game'
21
22
  ],
22
23
  install_requires=[
23
24
  'requests',
File without changes
File without changes
File without changes
File without changes