File tree Expand file tree Collapse file tree 3 files changed +35
-2
lines changed Expand file tree Collapse file tree 3 files changed +35
-2
lines changed Original file line number Diff line number Diff line change 16
16
__version__ = "0.1.0"
17
17
18
18
19
- from animu .client import Client
19
+ from animu .client import Client , AsyncClient
Original file line number Diff line number Diff line change 1
1
import aiohttp
2
+ import requests
3
+
2
4
from animu import model
3
5
4
6
class Client :
7
+ def __init__ (self , token : str ):
8
+ self ._header = {"Auth" : token }
9
+ self ._baseurl = "https://animu.ml/api/"
10
+
11
+ def _endpoint (self , endpoint : str ):
12
+ response = requests .get (f"{ self ._baseurl } { endpoint } " , headers = self ._header )
13
+ result = response .json ()
14
+ return result
5
15
16
+ def fact (self ):
17
+ data = self ._endpoint ('fact' )
18
+ return model .Fact (data )
19
+
20
+ def password (self ):
21
+ data = self ._endpoint ('password' )
22
+ return model .Password (data )
23
+
24
+ def quote (self ):
25
+ data = self ._endpoint ('quote' )
26
+ return model .Quote (data )
27
+
28
+ def roleplay (self , query : str ):
29
+ data = self ._endpoint (query )
30
+ return model .Roleplay (data )
31
+
32
+ def waifu (self ):
33
+ data = self ._endpoint ('waifu' )
34
+ return model .Waifu (data )
35
+
36
+
37
+ class AsyncClient :
6
38
def __init__ (self , token : str ):
7
39
self ._header = {"Auth" : token }
8
40
self ._baseurl = "https://animu.ml/api/"
Original file line number Diff line number Diff line change 1
- aiohttp
1
+ aiohttp
2
+ requests
You can’t perform that action at this time.
0 commit comments