nsarchive 3.0.0a5__tar.gz → 3.0.0a7__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.
- {nsarchive-3.0.0a5 → nsarchive-3.0.0a7}/PKG-INFO +2 -1
- {nsarchive-3.0.0a5 → nsarchive-3.0.0a7}/nsarchive/__init__.py +1 -1
- {nsarchive-3.0.0a5 → nsarchive-3.0.0a7}/nsarchive/cls/entities.py +1 -0
- {nsarchive-3.0.0a5 → nsarchive-3.0.0a7}/nsarchive/instances/_entities.py +16 -4
- {nsarchive-3.0.0a5 → nsarchive-3.0.0a7}/pyproject.toml +2 -1
- {nsarchive-3.0.0a5 → nsarchive-3.0.0a7}/LICENSE +0 -0
- {nsarchive-3.0.0a5 → nsarchive-3.0.0a7}/README.md +0 -0
- {nsarchive-3.0.0a5 → nsarchive-3.0.0a7}/nsarchive/assets/default_avatar.png +0 -0
- {nsarchive-3.0.0a5 → nsarchive-3.0.0a7}/nsarchive/cls/archives.py +0 -0
- {nsarchive-3.0.0a5 → nsarchive-3.0.0a7}/nsarchive/cls/base.py +0 -0
- {nsarchive-3.0.0a5 → nsarchive-3.0.0a7}/nsarchive/cls/economy.py +0 -0
- {nsarchive-3.0.0a5 → nsarchive-3.0.0a7}/nsarchive/cls/republic.py +0 -0
- {nsarchive-3.0.0a5 → nsarchive-3.0.0a7}/nsarchive/instances/_economy.py +0 -0
- {nsarchive-3.0.0a5 → nsarchive-3.0.0a7}/nsarchive/instances/_republic.py +0 -0
- {nsarchive-3.0.0a5 → nsarchive-3.0.0a7}/nsarchive/utils.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: nsarchive
|
3
|
-
Version: 3.0.
|
3
|
+
Version: 3.0.0a7
|
4
4
|
Summary: API-wrapper pour récupérer des données liées à Nation
|
5
5
|
License: GPL-3.0
|
6
6
|
Author: happex
|
@@ -12,6 +12,7 @@ Classifier: Programming Language :: Python :: 3.10
|
|
12
12
|
Classifier: Programming Language :: Python :: 3.11
|
13
13
|
Classifier: Programming Language :: Python :: 3.12
|
14
14
|
Requires-Dist: pillow (>=10.4,<11.0)
|
15
|
+
Requires-Dist: requests (>=2.31,<3.0)
|
15
16
|
Description-Content-Type: text/markdown
|
16
17
|
|
17
18
|
# NSArchive
|
@@ -52,12 +52,12 @@ class EntityInstance(Instance):
|
|
52
52
|
if _data is None: # ID inexistant chez les entités
|
53
53
|
return None
|
54
54
|
|
55
|
-
if _data['_class'] == '
|
55
|
+
if _data['_class'] == 'individuals':
|
56
56
|
entity = User(id)
|
57
57
|
entity._url = f"{self.url}/model/individuals/{id}"
|
58
58
|
|
59
59
|
entity._load(_data)
|
60
|
-
elif _data['_class'] == '
|
60
|
+
elif _data['_class'] == 'organizations':
|
61
61
|
entity = Organization(id)
|
62
62
|
entity._url = f"{self.url}/model/organizations/{id}"
|
63
63
|
|
@@ -92,11 +92,23 @@ class EntityInstance(Instance):
|
|
92
92
|
return entity
|
93
93
|
|
94
94
|
def get_entity_groups(self, entity: User) -> list[Organization]:
|
95
|
-
print(entity._url)
|
96
95
|
res = requests.get(f"{entity._url}/groups", headers = self.default_headers)
|
97
96
|
|
98
97
|
if res.status_code == 200:
|
99
|
-
|
98
|
+
data = res.json()
|
99
|
+
groups = []
|
100
|
+
|
101
|
+
for grp in data:
|
102
|
+
if grp is None: continue
|
103
|
+
|
104
|
+
group = Organization(grp["id"])
|
105
|
+
group._url = f"{self.url}/model/organizations/{grp['id']}"
|
106
|
+
|
107
|
+
group._load(grp)
|
108
|
+
|
109
|
+
groups.append(group)
|
110
|
+
|
111
|
+
return groups
|
100
112
|
else:
|
101
113
|
res.raise_for_status()
|
102
114
|
return []
|
@@ -1,6 +1,6 @@
|
|
1
1
|
[tool.poetry]
|
2
2
|
name = "nsarchive"
|
3
|
-
version = "3.0.
|
3
|
+
version = "3.0.0a7"
|
4
4
|
description = "API-wrapper pour récupérer des données liées à Nation"
|
5
5
|
authors = ["happex <110610727+okayhappex@users.noreply.github.com>"]
|
6
6
|
license = "GPL-3.0"
|
@@ -9,6 +9,7 @@ readme = "README.md"
|
|
9
9
|
[tool.poetry.dependencies]
|
10
10
|
python = "^3.10"
|
11
11
|
pillow = "^10.4"
|
12
|
+
requests = "^2.31"
|
12
13
|
|
13
14
|
[build-system]
|
14
15
|
requires = ["poetry-core"]
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|