aio-nookipedia 0.1.8__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.
- aio_nookipedia-0.1.8/LICENSE +13 -0
- aio_nookipedia-0.1.8/PKG-INFO +48 -0
- aio_nookipedia-0.1.8/README.md +34 -0
- aio_nookipedia-0.1.8/pyproject.toml +22 -0
- aio_nookipedia-0.1.8/setup.cfg +4 -0
- aio_nookipedia-0.1.8/src/aio_nookipedia.egg-info/PKG-INFO +48 -0
- aio_nookipedia-0.1.8/src/aio_nookipedia.egg-info/SOURCES.txt +31 -0
- aio_nookipedia-0.1.8/src/aio_nookipedia.egg-info/dependency_links.txt +1 -0
- aio_nookipedia-0.1.8/src/aio_nookipedia.egg-info/requires.txt +1 -0
- aio_nookipedia-0.1.8/src/aio_nookipedia.egg-info/top_level.txt +1 -0
- aio_nookipedia-0.1.8/src/aionookipedia/__init__.py +8 -0
- aio_nookipedia-0.1.8/src/aionookipedia/client.py +245 -0
- aio_nookipedia-0.1.8/src/aionookipedia/resources/__init__.py +3 -0
- aio_nookipedia-0.1.8/src/aionookipedia/resources/events.py +6 -0
- aio_nookipedia-0.1.8/src/aionookipedia/resources/items/__init__.py +8 -0
- aio_nookipedia-0.1.8/src/aionookipedia/resources/items/clothing.py +12 -0
- aio_nookipedia-0.1.8/src/aionookipedia/resources/items/furniture.py +28 -0
- aio_nookipedia-0.1.8/src/aionookipedia/resources/items/gyroid.py +14 -0
- aio_nookipedia-0.1.8/src/aionookipedia/resources/items/interior_item.py +16 -0
- aio_nookipedia-0.1.8/src/aionookipedia/resources/items/item.py +39 -0
- aio_nookipedia-0.1.8/src/aionookipedia/resources/items/misc.py +16 -0
- aio_nookipedia-0.1.8/src/aionookipedia/resources/items/photo.py +11 -0
- aio_nookipedia-0.1.8/src/aionookipedia/resources/items/tool.py +11 -0
- aio_nookipedia-0.1.8/src/aionookipedia/resources/museum/__init__.py +9 -0
- aio_nookipedia-0.1.8/src/aionookipedia/resources/museum/artwork.py +23 -0
- aio_nookipedia-0.1.8/src/aionookipedia/resources/museum/bug.py +8 -0
- aio_nookipedia-0.1.8/src/aionookipedia/resources/museum/critter.py +29 -0
- aio_nookipedia-0.1.8/src/aionookipedia/resources/museum/fish.py +8 -0
- aio_nookipedia-0.1.8/src/aionookipedia/resources/museum/fossil.py +29 -0
- aio_nookipedia-0.1.8/src/aionookipedia/resources/museum/sea_creature.py +7 -0
- aio_nookipedia-0.1.8/src/aionookipedia/resources/recipe.py +26 -0
- aio_nookipedia-0.1.8/src/aionookipedia/resources/villager.py +48 -0
- aio_nookipedia-0.1.8/tests/test.py +24 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
|
2
|
+
Version 2, December 2004
|
|
3
|
+
|
|
4
|
+
Copyright (C) 2025-present FormlessDuck
|
|
5
|
+
|
|
6
|
+
Everyone is permitted to copy and distribute verbatim or modified
|
|
7
|
+
copies of this license document, and changing it is allowed as long
|
|
8
|
+
as the name is changed.
|
|
9
|
+
|
|
10
|
+
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
|
11
|
+
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
|
12
|
+
|
|
13
|
+
0. You just DO WHAT THE FUCK YOU WANT TO.
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: aio-nookipedia
|
|
3
|
+
Version: 0.1.8
|
|
4
|
+
Summary: A simple, easy to use python wrapper for the Nookipedia API
|
|
5
|
+
Author: FormlessDuck
|
|
6
|
+
License-Expression: WTFPL
|
|
7
|
+
Classifier: Programming Language :: Python :: 3
|
|
8
|
+
Classifier: Operating System :: OS Independent
|
|
9
|
+
Requires-Python: >=3.13.7
|
|
10
|
+
Description-Content-Type: text/markdown
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Requires-Dist: aiohttp-client-cache
|
|
13
|
+
Dynamic: license-file
|
|
14
|
+
|
|
15
|
+
#AIO-Nookipedia
|
|
16
|
+
A simple, all-in-one python wrapper for the Nookipedia API
|
|
17
|
+
|
|
18
|
+
Nookipedia is a community-driven Animal Crossing wiki.
|
|
19
|
+
The main page of the Nookipedia wiki can be found [here](https://nookipedia.com/wiki/Main_Page).
|
|
20
|
+
|
|
21
|
+
##General Usage:
|
|
22
|
+
Every endpoint in the API is accessible through the `get` functions inside `NookClient` found in [client.py](src\aionookipedia\client.py)
|
|
23
|
+
|
|
24
|
+
For security in your own project, it is best if you use python-dotenv to load your api key, but you can pass the api key into `NookClient()`
|
|
25
|
+
manually if you wish.
|
|
26
|
+
|
|
27
|
+
```python
|
|
28
|
+
import asyncio
|
|
29
|
+
from aionookipedia.client import NookClient
|
|
30
|
+
from dotenv import load_dotenv
|
|
31
|
+
import os
|
|
32
|
+
|
|
33
|
+
#Example Usage:
|
|
34
|
+
|
|
35
|
+
async def main():
|
|
36
|
+
load_dotenv()
|
|
37
|
+
apiKey = os.getenv("API_KEY")
|
|
38
|
+
async with NookClient(apiKey) as client:
|
|
39
|
+
data = await client.getFish('pike')
|
|
40
|
+
print(data.name)
|
|
41
|
+
|
|
42
|
+
asyncio.run(main())
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
#AIO-Nookipedia
|
|
2
|
+
A simple, all-in-one python wrapper for the Nookipedia API
|
|
3
|
+
|
|
4
|
+
Nookipedia is a community-driven Animal Crossing wiki.
|
|
5
|
+
The main page of the Nookipedia wiki can be found [here](https://nookipedia.com/wiki/Main_Page).
|
|
6
|
+
|
|
7
|
+
##General Usage:
|
|
8
|
+
Every endpoint in the API is accessible through the `get` functions inside `NookClient` found in [client.py](src\aionookipedia\client.py)
|
|
9
|
+
|
|
10
|
+
For security in your own project, it is best if you use python-dotenv to load your api key, but you can pass the api key into `NookClient()`
|
|
11
|
+
manually if you wish.
|
|
12
|
+
|
|
13
|
+
```python
|
|
14
|
+
import asyncio
|
|
15
|
+
from aionookipedia.client import NookClient
|
|
16
|
+
from dotenv import load_dotenv
|
|
17
|
+
import os
|
|
18
|
+
|
|
19
|
+
#Example Usage:
|
|
20
|
+
|
|
21
|
+
async def main():
|
|
22
|
+
load_dotenv()
|
|
23
|
+
apiKey = os.getenv("API_KEY")
|
|
24
|
+
async with NookClient(apiKey) as client:
|
|
25
|
+
data = await client.getFish('pike')
|
|
26
|
+
print(data.name)
|
|
27
|
+
|
|
28
|
+
asyncio.run(main())
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools >= 77.0.3"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "aio-nookipedia"
|
|
7
|
+
version = "0.1.8"
|
|
8
|
+
authors = [
|
|
9
|
+
{name = "FormlessDuck"},
|
|
10
|
+
]
|
|
11
|
+
description = "A simple, easy to use python wrapper for the Nookipedia API"
|
|
12
|
+
readme = "README.md"
|
|
13
|
+
requires-python = ">=3.13.7"
|
|
14
|
+
classifiers = [
|
|
15
|
+
"Programming Language :: Python :: 3",
|
|
16
|
+
"Operating System :: OS Independent",
|
|
17
|
+
]
|
|
18
|
+
dependencies = [
|
|
19
|
+
"aiohttp-client-cache"
|
|
20
|
+
]
|
|
21
|
+
license = "WTFPL"
|
|
22
|
+
license-files = ["LICEN[CS]E*"]
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: aio-nookipedia
|
|
3
|
+
Version: 0.1.8
|
|
4
|
+
Summary: A simple, easy to use python wrapper for the Nookipedia API
|
|
5
|
+
Author: FormlessDuck
|
|
6
|
+
License-Expression: WTFPL
|
|
7
|
+
Classifier: Programming Language :: Python :: 3
|
|
8
|
+
Classifier: Operating System :: OS Independent
|
|
9
|
+
Requires-Python: >=3.13.7
|
|
10
|
+
Description-Content-Type: text/markdown
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Requires-Dist: aiohttp-client-cache
|
|
13
|
+
Dynamic: license-file
|
|
14
|
+
|
|
15
|
+
#AIO-Nookipedia
|
|
16
|
+
A simple, all-in-one python wrapper for the Nookipedia API
|
|
17
|
+
|
|
18
|
+
Nookipedia is a community-driven Animal Crossing wiki.
|
|
19
|
+
The main page of the Nookipedia wiki can be found [here](https://nookipedia.com/wiki/Main_Page).
|
|
20
|
+
|
|
21
|
+
##General Usage:
|
|
22
|
+
Every endpoint in the API is accessible through the `get` functions inside `NookClient` found in [client.py](src\aionookipedia\client.py)
|
|
23
|
+
|
|
24
|
+
For security in your own project, it is best if you use python-dotenv to load your api key, but you can pass the api key into `NookClient()`
|
|
25
|
+
manually if you wish.
|
|
26
|
+
|
|
27
|
+
```python
|
|
28
|
+
import asyncio
|
|
29
|
+
from aionookipedia.client import NookClient
|
|
30
|
+
from dotenv import load_dotenv
|
|
31
|
+
import os
|
|
32
|
+
|
|
33
|
+
#Example Usage:
|
|
34
|
+
|
|
35
|
+
async def main():
|
|
36
|
+
load_dotenv()
|
|
37
|
+
apiKey = os.getenv("API_KEY")
|
|
38
|
+
async with NookClient(apiKey) as client:
|
|
39
|
+
data = await client.getFish('pike')
|
|
40
|
+
print(data.name)
|
|
41
|
+
|
|
42
|
+
asyncio.run(main())
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
pyproject.toml
|
|
4
|
+
src/aio_nookipedia.egg-info/PKG-INFO
|
|
5
|
+
src/aio_nookipedia.egg-info/SOURCES.txt
|
|
6
|
+
src/aio_nookipedia.egg-info/dependency_links.txt
|
|
7
|
+
src/aio_nookipedia.egg-info/requires.txt
|
|
8
|
+
src/aio_nookipedia.egg-info/top_level.txt
|
|
9
|
+
src/aionookipedia/__init__.py
|
|
10
|
+
src/aionookipedia/client.py
|
|
11
|
+
src/aionookipedia/resources/__init__.py
|
|
12
|
+
src/aionookipedia/resources/events.py
|
|
13
|
+
src/aionookipedia/resources/recipe.py
|
|
14
|
+
src/aionookipedia/resources/villager.py
|
|
15
|
+
src/aionookipedia/resources/items/__init__.py
|
|
16
|
+
src/aionookipedia/resources/items/clothing.py
|
|
17
|
+
src/aionookipedia/resources/items/furniture.py
|
|
18
|
+
src/aionookipedia/resources/items/gyroid.py
|
|
19
|
+
src/aionookipedia/resources/items/interior_item.py
|
|
20
|
+
src/aionookipedia/resources/items/item.py
|
|
21
|
+
src/aionookipedia/resources/items/misc.py
|
|
22
|
+
src/aionookipedia/resources/items/photo.py
|
|
23
|
+
src/aionookipedia/resources/items/tool.py
|
|
24
|
+
src/aionookipedia/resources/museum/__init__.py
|
|
25
|
+
src/aionookipedia/resources/museum/artwork.py
|
|
26
|
+
src/aionookipedia/resources/museum/bug.py
|
|
27
|
+
src/aionookipedia/resources/museum/critter.py
|
|
28
|
+
src/aionookipedia/resources/museum/fish.py
|
|
29
|
+
src/aionookipedia/resources/museum/fossil.py
|
|
30
|
+
src/aionookipedia/resources/museum/sea_creature.py
|
|
31
|
+
tests/test.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
aiohttp-client-cache
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
aionookipedia
|
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
from aiohttp_client_cache.session import CachedSession
|
|
2
|
+
from aionookipedia.resources import Villager
|
|
3
|
+
from aionookipedia.resources import Recipe
|
|
4
|
+
from aionookipedia.resources import Event
|
|
5
|
+
from aionookipedia.resources.museum import (
|
|
6
|
+
Fish,
|
|
7
|
+
Bug,
|
|
8
|
+
SeaCreature,
|
|
9
|
+
Artwork,
|
|
10
|
+
Fossil,
|
|
11
|
+
FossilGroup,
|
|
12
|
+
FossilSet
|
|
13
|
+
)
|
|
14
|
+
from aionookipedia.resources.items import (
|
|
15
|
+
Clothing,
|
|
16
|
+
Furniture,
|
|
17
|
+
InteriorItem,
|
|
18
|
+
Tool,
|
|
19
|
+
Photo,
|
|
20
|
+
MiscItem,
|
|
21
|
+
Gyroid
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
apiVersion = "1.7.0"
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class NookClient:
|
|
28
|
+
|
|
29
|
+
def __init__(self, apiKey = None, baseUrl = "https://api.nookipedia.com"):
|
|
30
|
+
self.baseUrl = baseUrl
|
|
31
|
+
self.session = CachedSession(expire_after=21600) #Cache expires after 6 hours
|
|
32
|
+
self.apiKey = apiKey
|
|
33
|
+
|
|
34
|
+
async def __aenter__(self):
|
|
35
|
+
return self
|
|
36
|
+
|
|
37
|
+
async def __aexit__(self, *args):
|
|
38
|
+
await self.close()
|
|
39
|
+
|
|
40
|
+
async def close(self):
|
|
41
|
+
await self.session.close()
|
|
42
|
+
|
|
43
|
+
async def fetchJson(self, url: str):
|
|
44
|
+
header = {"X-API-KEY": self.apiKey, "Accept-Version": apiVersion}
|
|
45
|
+
response = await self.session.get(url, headers=header)
|
|
46
|
+
return await response.json()
|
|
47
|
+
|
|
48
|
+
async def getVillager(self, name: str):
|
|
49
|
+
data = await self.fetchJson(f"{self.baseUrl}/villagers?name={name}&nhdetails=true".lower())
|
|
50
|
+
villager = Villager(data[0])
|
|
51
|
+
return villager
|
|
52
|
+
|
|
53
|
+
async def getAllVillagers(self):
|
|
54
|
+
villagers_raw = await self.fetchJson(f"{self.baseUrl}/villagers?nhdetails=true".lower())
|
|
55
|
+
villagers = []
|
|
56
|
+
for x in villagers_raw:
|
|
57
|
+
villagers.append(Villager(x))
|
|
58
|
+
return villagers
|
|
59
|
+
|
|
60
|
+
async def getFish(self, name: str):
|
|
61
|
+
data = await self.fetchJson(f"{self.baseUrl}/nh/fish/{name}".lower())
|
|
62
|
+
fish = Fish(data)
|
|
63
|
+
return fish
|
|
64
|
+
|
|
65
|
+
async def getAllFish(self):
|
|
66
|
+
fish_raw = await self.fetchJson(f"{self.baseUrl}/nh/fish".lower())
|
|
67
|
+
fish = []
|
|
68
|
+
for x in fish_raw:
|
|
69
|
+
fish.append(Fish(x))
|
|
70
|
+
return fish
|
|
71
|
+
|
|
72
|
+
async def getBug(self, name: str):
|
|
73
|
+
data = await self.fetchJson(f"{self.baseUrl}/nh/bugs/{name}".lower())
|
|
74
|
+
bug = Bug(data)
|
|
75
|
+
return bug
|
|
76
|
+
|
|
77
|
+
async def getAllBugs(self):
|
|
78
|
+
bugs_raw = await self.fetchJson(f"{self.baseUrl}/nh/bugs".lower())
|
|
79
|
+
bugs = []
|
|
80
|
+
for x in bugs_raw:
|
|
81
|
+
bugs.append(Bug(x))
|
|
82
|
+
return bugs
|
|
83
|
+
|
|
84
|
+
async def getSeaCreature(self, name: str):
|
|
85
|
+
data = await self.fetchJson(f"{self.baseUrl}/nh/sea/{name}".lower())
|
|
86
|
+
seaCreature = SeaCreature(data)
|
|
87
|
+
return seaCreature
|
|
88
|
+
|
|
89
|
+
async def getAllSeaCreatures(self):
|
|
90
|
+
seaCreatures_raw = await self.fetchJson(f"{self.baseUrl}/nh/sea".lower())
|
|
91
|
+
seaCreatures = []
|
|
92
|
+
for x in seaCreatures_raw:
|
|
93
|
+
seaCreatures.append(SeaCreature(x))
|
|
94
|
+
return seaCreatures
|
|
95
|
+
|
|
96
|
+
async def getArtwork(self, name: str):
|
|
97
|
+
data = await self.fetchJson(f"{self.baseUrl}/nh/art/{name}".lower())
|
|
98
|
+
artwork = Artwork(data)
|
|
99
|
+
return artwork
|
|
100
|
+
|
|
101
|
+
async def getAllArtwork(self):
|
|
102
|
+
artworks_raw = await self.fetchJson(f"{self.baseUrl}/nh/art".lower())
|
|
103
|
+
artworks = []
|
|
104
|
+
for x in artworks_raw:
|
|
105
|
+
artworks.append(Artwork(x))
|
|
106
|
+
return artworks
|
|
107
|
+
|
|
108
|
+
async def getFossil(self, name: str):
|
|
109
|
+
data = await self.fetchJson(f"{self.baseUrl}/nh/fossils/individuals/{name}".lower())
|
|
110
|
+
fossil = Fossil(data)
|
|
111
|
+
return fossil
|
|
112
|
+
|
|
113
|
+
async def getAllFossils(self):
|
|
114
|
+
fossils_raw = await self.fetchJson(f"{self.baseUrl}/nh/fossils/individuals".lower())
|
|
115
|
+
fossils = []
|
|
116
|
+
for x in fossils_raw:
|
|
117
|
+
fossils.append(Fossil(x))
|
|
118
|
+
return fossils
|
|
119
|
+
|
|
120
|
+
async def getFossilGroup(self, name: str):
|
|
121
|
+
data = await self.fetchJson(f"{self.baseUrl}/nh/fossils/groups/{name}".lower())
|
|
122
|
+
fossilGroup = FossilGroup(data)
|
|
123
|
+
return fossilGroup
|
|
124
|
+
|
|
125
|
+
async def getAllFossilGroups(self):
|
|
126
|
+
fossilGroups_raw = await self.fetchJson(f"{self.baseUrl}/nh/fossils/groups".lower())
|
|
127
|
+
fossilGroups = []
|
|
128
|
+
for x in fossilGroups_raw:
|
|
129
|
+
fossilGroups.append(FossilGroup(x))
|
|
130
|
+
return fossilGroups
|
|
131
|
+
|
|
132
|
+
async def getFossilSet(self, name: str):
|
|
133
|
+
data = await self.fetchJson(f"{self.baseUrl}/nh/fossils/all/{name}".lower())
|
|
134
|
+
fossilSet = FossilSet(data)
|
|
135
|
+
return fossilSet
|
|
136
|
+
|
|
137
|
+
async def getAllFossilSets(self):
|
|
138
|
+
fossilSets_raw = await self.fetchJson(f"{self.baseUrl}/nh/fossils/all".lower())
|
|
139
|
+
fossilSets = []
|
|
140
|
+
for x in fossilSets_raw:
|
|
141
|
+
fossilSets.append(FossilSet(x))
|
|
142
|
+
return fossilSets
|
|
143
|
+
|
|
144
|
+
async def getFurniture(self, name: str):
|
|
145
|
+
data = await self.fetchJson(f"{self.baseUrl}/nh/furniture/{name}".lower())
|
|
146
|
+
furniture = Furniture(data)
|
|
147
|
+
return furniture
|
|
148
|
+
|
|
149
|
+
async def getAllFurniture(self):
|
|
150
|
+
furniture_raw = await self.fetchJson(f"{self.baseUrl}/nh/furniture".lower())
|
|
151
|
+
furniture = []
|
|
152
|
+
for x in furniture_raw:
|
|
153
|
+
furniture.append(Furniture(x))
|
|
154
|
+
return furniture
|
|
155
|
+
|
|
156
|
+
async def getClothing(self, name: str):
|
|
157
|
+
data = await self.fetchJson(f"{self.baseUrl}/nh/clothing/{name}".lower())
|
|
158
|
+
clothing = Clothing(data)
|
|
159
|
+
return clothing
|
|
160
|
+
|
|
161
|
+
async def getAllClothing(self):
|
|
162
|
+
clothing_raw = await self.fetchJson(f"{self.baseUrl}/nh/clothing".lower())
|
|
163
|
+
clothing = []
|
|
164
|
+
for x in clothing_raw:
|
|
165
|
+
clothing.append(Clothing(x))
|
|
166
|
+
return clothing
|
|
167
|
+
|
|
168
|
+
async def getInteriorItem(self, name: str):
|
|
169
|
+
data = await self.fetchJson(f"{self.baseUrl}/nh/interior/{name}".lower())
|
|
170
|
+
item = InteriorItem(data)
|
|
171
|
+
return item
|
|
172
|
+
|
|
173
|
+
async def getAllInteriorItems(self):
|
|
174
|
+
items_raw = await self.fetchJson(f"{self.baseUrl}/nh/interior".lower())
|
|
175
|
+
items = []
|
|
176
|
+
for x in items_raw:
|
|
177
|
+
items.append(InteriorItem(x))
|
|
178
|
+
return items
|
|
179
|
+
|
|
180
|
+
async def getTool(self, name: str):
|
|
181
|
+
data = await self.fetchJson(f"{self.baseUrl}/nh/tools/{name}".lower())
|
|
182
|
+
tool = Tool(data)
|
|
183
|
+
return tool
|
|
184
|
+
|
|
185
|
+
async def getAllTools(self):
|
|
186
|
+
tools_raw = await self.fetchJson(f"{self.baseUrl}/nh/tools".lower())
|
|
187
|
+
tools = []
|
|
188
|
+
for x in tools_raw:
|
|
189
|
+
tools.append(Tool(x))
|
|
190
|
+
return tools
|
|
191
|
+
|
|
192
|
+
async def getPhoto(self, name:str):
|
|
193
|
+
data = await self.fetchJson(f"{self.baseUrl}/nh/photos/{name}".lower())
|
|
194
|
+
photo = Photo(data)
|
|
195
|
+
return photo
|
|
196
|
+
|
|
197
|
+
async def getAllPhotos(self):
|
|
198
|
+
photos_raw = await self.fetchJson(f"{self.baseUrl}/nh/photos".lower())
|
|
199
|
+
photos = []
|
|
200
|
+
for x in photos_raw:
|
|
201
|
+
photos.append(Photo(x))
|
|
202
|
+
return photos
|
|
203
|
+
|
|
204
|
+
async def getMiscItem(self, name:str):
|
|
205
|
+
data = await self.fetchJson(f"{self.baseUrl}/nh/items/{name}".lower())
|
|
206
|
+
item = MiscItem(data)
|
|
207
|
+
return item
|
|
208
|
+
|
|
209
|
+
async def getAllMiscItems(self):
|
|
210
|
+
items_raw = await self.fetchJson(f"{self.baseUrl}/nh/items".lower())
|
|
211
|
+
items = []
|
|
212
|
+
for x in items_raw:
|
|
213
|
+
items.append(MiscItem(x))
|
|
214
|
+
return items
|
|
215
|
+
|
|
216
|
+
async def getGyroid(self, name:str):
|
|
217
|
+
data = await self.fetchJson(f"{self.baseUrl}/nh/gyroids/{name}".lower())
|
|
218
|
+
gyroid = Gyroid(data)
|
|
219
|
+
return gyroid
|
|
220
|
+
|
|
221
|
+
async def getAllGyroids(self):
|
|
222
|
+
gyroids_raw = await self.fetchJson(f"{self.baseUrl}/nh/gyroids".lower())
|
|
223
|
+
gyroids = []
|
|
224
|
+
for x in gyroids_raw:
|
|
225
|
+
gyroids.append(Gyroid(x))
|
|
226
|
+
return gyroids
|
|
227
|
+
|
|
228
|
+
async def getRecipe(self, name: str):
|
|
229
|
+
data = await self.fetchJson(f"{self.baseUrl}/nh/recipes/{name}".lower())
|
|
230
|
+
recipe = Recipe(data)
|
|
231
|
+
return recipe
|
|
232
|
+
|
|
233
|
+
async def getAllRecipes(self):
|
|
234
|
+
recipes_raw = await self.fetchJson(f"{self.baseUrl}/nh/recipes".lower())
|
|
235
|
+
recipes = []
|
|
236
|
+
for x in recipes_raw:
|
|
237
|
+
recipes.append(Recipe(x))
|
|
238
|
+
return recipes
|
|
239
|
+
|
|
240
|
+
async def getAllEvents(self):
|
|
241
|
+
events_raw = await self.fetchJson(f"{self.baseUrl}/nh/events".lower())
|
|
242
|
+
events = []
|
|
243
|
+
for x in events_raw:
|
|
244
|
+
events.append(Event(x))
|
|
245
|
+
return events
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
from .item import Item
|
|
2
|
+
|
|
3
|
+
class Clothing(Item):
|
|
4
|
+
def __init__(self, data: dict):
|
|
5
|
+
super().__init__(data)
|
|
6
|
+
self.variation_total = data['variation_total']
|
|
7
|
+
self.vill_equip = data['vill_equip']
|
|
8
|
+
self.seasonality = data['seasonality']
|
|
9
|
+
self.notes = data['notes']
|
|
10
|
+
self.label_themes = data['label_themes']
|
|
11
|
+
self.styles = data['styles']
|
|
12
|
+
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
from .item import Item
|
|
2
|
+
|
|
3
|
+
class Furniture(Item):
|
|
4
|
+
def __init__(self, data: dict):
|
|
5
|
+
super().__init__(data)
|
|
6
|
+
self.item_series = data['item_series']
|
|
7
|
+
self.item_set = data['item_set']
|
|
8
|
+
self.themes = data['themes']
|
|
9
|
+
self.hha_category = data['hha_category']
|
|
10
|
+
self.hha_base = data['hha_base']
|
|
11
|
+
self.tag = data['tag']
|
|
12
|
+
self.lucky = data['lucky']
|
|
13
|
+
self.lucky_season = data['lucky_season'] if 'lucky_season' in data else None
|
|
14
|
+
self.variation_total = data['variation_total']
|
|
15
|
+
self.pattern_total = data['pattern_total']
|
|
16
|
+
self.customizable = data['customizable']
|
|
17
|
+
self.custom_kits = data['custom_kits'] if 'custom_kits' in data else None
|
|
18
|
+
self.custom_kit_type = data['custom_kit_type'] if 'custom_kit_type' in data else None
|
|
19
|
+
self.custom_body_part = data['custom_body_part'] if 'custom_body_part' in data else None
|
|
20
|
+
self.custom_pattern_part = data['custom_pattern_part'] if 'custom_pattern_part' in data else None
|
|
21
|
+
self.grid_width = data['grid_width']
|
|
22
|
+
self.grid_length = data['grid_length']
|
|
23
|
+
self.height = data['height']
|
|
24
|
+
self.door_decor = data['door_decor']
|
|
25
|
+
self.functions = data['functions']
|
|
26
|
+
self.notes = data['notes']
|
|
27
|
+
|
|
28
|
+
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
from .item import Item
|
|
2
|
+
|
|
3
|
+
class Gyroid(Item):
|
|
4
|
+
def __init__(self, data: dict):
|
|
5
|
+
super().__init__(data)
|
|
6
|
+
self.hha_base = data['hha_base']
|
|
7
|
+
self.customizable = data['customizable']
|
|
8
|
+
self.custom_kits = data['custom_kits']
|
|
9
|
+
self.custom_body_part = data['custom_body_part']
|
|
10
|
+
self.cyrus_price = data['cyrus_price']
|
|
11
|
+
self.variation_total = data['variation_total']
|
|
12
|
+
self.grid_width = data['grid_width']
|
|
13
|
+
self.grid_length = data['grid_length']
|
|
14
|
+
self.sound = data['sound']
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
from .item import Item
|
|
2
|
+
|
|
3
|
+
class InteriorItem(Item):
|
|
4
|
+
def __init__(self, data: dict):
|
|
5
|
+
super().__init__(data)
|
|
6
|
+
self.image_url = data['image_url']
|
|
7
|
+
self.item_series = data['item_series']
|
|
8
|
+
self.item_set = data['item_set']
|
|
9
|
+
self.themes = data['themes']
|
|
10
|
+
self.hha_category = data['hha_category']
|
|
11
|
+
self.hha_base = data['hha_base']
|
|
12
|
+
self.tag = data['tag']
|
|
13
|
+
self.grid_width = data['grid_width']
|
|
14
|
+
self.grid_length = data['grid_length']
|
|
15
|
+
self.colors = data['colors']
|
|
16
|
+
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
class Item:
|
|
2
|
+
def __init__(self, data: dict):
|
|
3
|
+
self.name = data['name']
|
|
4
|
+
self.url = data['url']
|
|
5
|
+
self.category = data['category'] if 'category' in data else None
|
|
6
|
+
self.unlocked = data['unlocked'] if "unlocked" in data else None
|
|
7
|
+
self.sell = data['sell']
|
|
8
|
+
self.version_added = data['version_added']
|
|
9
|
+
self.notes = data['notes'] if 'notes' in data else None
|
|
10
|
+
prices = []
|
|
11
|
+
for price in data['buy']:
|
|
12
|
+
prices.append(Prices(price))
|
|
13
|
+
self.buy = prices
|
|
14
|
+
availability = []
|
|
15
|
+
for x in data['availability']:
|
|
16
|
+
availability.append(Availability(x))
|
|
17
|
+
self.availability = availability
|
|
18
|
+
if 'variations' in data:
|
|
19
|
+
variations = []
|
|
20
|
+
for x in data['variations']:
|
|
21
|
+
variations.append(Variations(x))
|
|
22
|
+
self.variations = variations if variations else None
|
|
23
|
+
|
|
24
|
+
class Availability:
|
|
25
|
+
def __init__(self, data: dict):
|
|
26
|
+
self.location = data['from']
|
|
27
|
+
self.note = data['note']
|
|
28
|
+
|
|
29
|
+
class Variations:
|
|
30
|
+
def __init__(self, data: dict):
|
|
31
|
+
self.variation = data['variation']
|
|
32
|
+
self.pattern = data['pattern'] if 'pattern' in data else None
|
|
33
|
+
self.image_url = data['image_url']
|
|
34
|
+
self.colors = data['colors'] if 'colors' in data else None
|
|
35
|
+
|
|
36
|
+
class Prices:
|
|
37
|
+
def __init__(self, data: dict):
|
|
38
|
+
self.price = data['price'] if 'price' in data else None
|
|
39
|
+
self.currency = data['currency'] if 'currency' in data else None
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
from .item import Item
|
|
2
|
+
|
|
3
|
+
class MiscItem(Item):
|
|
4
|
+
def __init__(self, data: dict):
|
|
5
|
+
super().__init__(data)
|
|
6
|
+
self.image_url = data['image_url']
|
|
7
|
+
self.stack = data['stack']
|
|
8
|
+
self.hha_base = data['hha_base']
|
|
9
|
+
self.is_fence = data['is_fence']
|
|
10
|
+
self.material_type = data['material_type']
|
|
11
|
+
self.material_seasonality = data['material_seasonality']
|
|
12
|
+
self.material_sort = data['material_sort']
|
|
13
|
+
self.material_name_sort = data['material_name_sort']
|
|
14
|
+
self.material_seasonailty_sort = data['material_seasonality_sort']
|
|
15
|
+
self.edible = data['edible']
|
|
16
|
+
self.plant_type = data['plant_type']
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
from .item import Item
|
|
2
|
+
|
|
3
|
+
class Photo(Item):
|
|
4
|
+
def __init__(self, data: dict):
|
|
5
|
+
super().__init__(data)
|
|
6
|
+
self.customizable = data['customizable']
|
|
7
|
+
self.custom_kits = data['custom_kits']
|
|
8
|
+
self.custom_body_part = data['custom_body_part']
|
|
9
|
+
self.grid_width = data['grid_width']
|
|
10
|
+
self.grid_length = data['grid_length']
|
|
11
|
+
self.interactable = data['interactable']
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
from .item import Item
|
|
2
|
+
|
|
3
|
+
class Tool(Item):
|
|
4
|
+
def __init__(self, data: dict):
|
|
5
|
+
super().__init__(data)
|
|
6
|
+
self.uses = data['uses']
|
|
7
|
+
self.hha_base = data['hha_base']
|
|
8
|
+
self.customizable = data['customizable']
|
|
9
|
+
self.custom_kits = data['custom_kits']
|
|
10
|
+
self.custom_body_part = data['custom_body_part']
|
|
11
|
+
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
class Artwork:
|
|
2
|
+
def __init__(self, data: dict):
|
|
3
|
+
self.name = data['name']
|
|
4
|
+
self.url = data['url']
|
|
5
|
+
self.has_fake = data['has_fake']
|
|
6
|
+
self.art_name = data['art_name']
|
|
7
|
+
self.art_type = data['art_type']
|
|
8
|
+
self.author = data['author']
|
|
9
|
+
self.year = data['year']
|
|
10
|
+
self.art_style = data['art_style']
|
|
11
|
+
self.buy = data['buy']
|
|
12
|
+
self.sell = data['sell']
|
|
13
|
+
self.availability = data['availability']
|
|
14
|
+
self.width = data['width']
|
|
15
|
+
self.length = data['length']
|
|
16
|
+
self.real_info = ArtworkInfo(data['real_info'])
|
|
17
|
+
self.fake_info = ArtworkInfo(data['fake_info']) if self.has_fake else None
|
|
18
|
+
|
|
19
|
+
class ArtworkInfo:
|
|
20
|
+
def __init__(self, data: dict):
|
|
21
|
+
self.image_url = data['image_url']
|
|
22
|
+
self.texture_url = data['texture_url']
|
|
23
|
+
self.description = data['description']
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
class Critter:
|
|
2
|
+
def __init__(self, data: dict):
|
|
3
|
+
self.url = data["url"]
|
|
4
|
+
self.name = data["name"]
|
|
5
|
+
self.image_url = data["image_url"]
|
|
6
|
+
self.catchphrases = data["catchphrases"]
|
|
7
|
+
self.rarity = data["rarity"]
|
|
8
|
+
self.total_catch = data["total_catch"]
|
|
9
|
+
self.sell_nook = data["sell_nook"]
|
|
10
|
+
self.tank_width = data["tank_width"]
|
|
11
|
+
self.tank_length = data["tank_length"]
|
|
12
|
+
self.north = HemisphereDetails(data["north"])
|
|
13
|
+
self.south = HemisphereDetails(data["south"])
|
|
14
|
+
|
|
15
|
+
class HemisphereDetails:
|
|
16
|
+
def __init__(self, data: dict):
|
|
17
|
+
self.availabiliy_array = []
|
|
18
|
+
for x in data["availability_array"]:
|
|
19
|
+
self.availabiliy_array.append(AvailabilityDetails(x))
|
|
20
|
+
self.months = data["months"]
|
|
21
|
+
self.times_by_month = data["times_by_month"]
|
|
22
|
+
self.months_array = data["months_array"]
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
class AvailabilityDetails:
|
|
27
|
+
def __init__(self, data: dict):
|
|
28
|
+
self.months = data["months"]
|
|
29
|
+
self.time = data["time"]
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
class Fossil:
|
|
2
|
+
def __init__(self, data: dict):
|
|
3
|
+
self.name = data['name']
|
|
4
|
+
self.url = data['url']
|
|
5
|
+
self.image_url = data['image_url']
|
|
6
|
+
self.fossil_group = data['fossil_group'] if 'fossil_group' in data else None
|
|
7
|
+
self.interactable = data['interactable']
|
|
8
|
+
self.sell = data['sell']
|
|
9
|
+
self.hha_base = data['hha_base']
|
|
10
|
+
self.width = data['width']
|
|
11
|
+
self.length = data['length']
|
|
12
|
+
self.colors = data['colors']
|
|
13
|
+
|
|
14
|
+
class FossilGroup:
|
|
15
|
+
def __init__(self, data: dict):
|
|
16
|
+
self.name = data['name']
|
|
17
|
+
self.url = data['url']
|
|
18
|
+
self.room = data['room']
|
|
19
|
+
self.description = data['description']
|
|
20
|
+
|
|
21
|
+
class FossilSet:
|
|
22
|
+
def __init__(self, data: dict):
|
|
23
|
+
self.name = data['name']
|
|
24
|
+
self.url = data['url']
|
|
25
|
+
self.room = data['room']
|
|
26
|
+
self.description = data['description']
|
|
27
|
+
self.fossils = []
|
|
28
|
+
for fossil in data['fossils']:
|
|
29
|
+
self.fossils.append(Fossil(fossil))
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
from .items.item import Prices
|
|
2
|
+
from .items.item import Availability
|
|
3
|
+
|
|
4
|
+
class Recipe:
|
|
5
|
+
def __init__(self, data: dict):
|
|
6
|
+
self.name = data['name']
|
|
7
|
+
self.url = data['url']
|
|
8
|
+
self.image_url = data['image_url']
|
|
9
|
+
self.serial_id = data['serial_id']
|
|
10
|
+
prices = []
|
|
11
|
+
for x in data['buy']:
|
|
12
|
+
prices.append(Prices(x))
|
|
13
|
+
self.buy = prices
|
|
14
|
+
availability = []
|
|
15
|
+
for x in data['availability']:
|
|
16
|
+
availability.append(Availability(x))
|
|
17
|
+
self.availability = availability
|
|
18
|
+
materials = []
|
|
19
|
+
for x in data['materials']:
|
|
20
|
+
materials.append(Material(x))
|
|
21
|
+
self.materials = materials
|
|
22
|
+
|
|
23
|
+
class Material:
|
|
24
|
+
def __init__(self, data: dict):
|
|
25
|
+
self.name = data['name']
|
|
26
|
+
self.count = data['count']
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
class Villager:
|
|
2
|
+
def __init__(self, data: dict):
|
|
3
|
+
self.id = data["id"]
|
|
4
|
+
self.url = data["url"]
|
|
5
|
+
self.name = data["name"]
|
|
6
|
+
self.alt_name = data["alt_name"]
|
|
7
|
+
self.title_color = data["title_color"]
|
|
8
|
+
self.text_color = data["text_color"]
|
|
9
|
+
self.image_url = data["image_url"]
|
|
10
|
+
self.species = data["species"]
|
|
11
|
+
self.personality = data["personality"]
|
|
12
|
+
self.gender = data["gender"]
|
|
13
|
+
self.birthday_day = data["birthday_day"]
|
|
14
|
+
self.birthday_month = data["birthday_month"]
|
|
15
|
+
self.sign = data["sign"]
|
|
16
|
+
self.quote = data["quote"]
|
|
17
|
+
self.phrase = data["phrase"]
|
|
18
|
+
self.prev_phrases = data["prev_phrases"]
|
|
19
|
+
self.clothing = data["clothing"]
|
|
20
|
+
self.islander = data["islander"]
|
|
21
|
+
self.debut = data["debut"]
|
|
22
|
+
self.appearances = data["appearances"]
|
|
23
|
+
self.nh_details = NHDetails(data["nh_details"]) if data['nh_details'] is not None else None
|
|
24
|
+
|
|
25
|
+
@property
|
|
26
|
+
def birthday(self) -> str:
|
|
27
|
+
return f"{self.birthday_month} {self.birthday_day}"
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
class NHDetails:
|
|
31
|
+
def __init__(self, data: dict):
|
|
32
|
+
self.photo_url = data["photo_url"]
|
|
33
|
+
self.image_url = data["image_url"]
|
|
34
|
+
self.icon_url = data["icon_url"]
|
|
35
|
+
self.quote = data["quote"]
|
|
36
|
+
self.sub_personality = data["sub-personality"]
|
|
37
|
+
self.catchphrase = data["catchphrase"]
|
|
38
|
+
self.clothing = data["clothing"]
|
|
39
|
+
self.clothing_variation = data["clothing_variation"]
|
|
40
|
+
self.fav_styles = data["fav_styles"]
|
|
41
|
+
self.hobby = data["hobby"]
|
|
42
|
+
self.house_interior_url = data["house_interior_url"]
|
|
43
|
+
self.house_exterior_url = data["house_exterior_url"]
|
|
44
|
+
self.house_wallpaper = data["house_wallpaper"]
|
|
45
|
+
self.house_flooring = data["house_flooring"]
|
|
46
|
+
self.house_music = data["house_music"]
|
|
47
|
+
self.house_music_note = data["house_music_note"]
|
|
48
|
+
self.umbrella = data["umbrella"]
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import asyncio
|
|
2
|
+
from aionookipedia.client import NookClient
|
|
3
|
+
from dotenv import load_dotenv
|
|
4
|
+
import os
|
|
5
|
+
|
|
6
|
+
#Emaxple Usage:
|
|
7
|
+
# async def getVillagersBySpecies(species: str):
|
|
8
|
+
# data = await client.getAllVillagers()
|
|
9
|
+
# villagers = []
|
|
10
|
+
# for x in data:
|
|
11
|
+
# if x.species == species.title():
|
|
12
|
+
# villagers.append(x)
|
|
13
|
+
# else:
|
|
14
|
+
# continue
|
|
15
|
+
# return villagers
|
|
16
|
+
|
|
17
|
+
async def main():
|
|
18
|
+
load_dotenv()
|
|
19
|
+
apiKey = os.getenv("API_KEY")
|
|
20
|
+
async with NookClient(apiKey) as client:
|
|
21
|
+
data = await client.getFish('pike')
|
|
22
|
+
print(data.name)
|
|
23
|
+
|
|
24
|
+
asyncio.run(main())
|