meander-api 0.1.0__py3-none-any.whl

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.
MeanderAPI/__init__.py ADDED
@@ -0,0 +1,9 @@
1
+ from .client import client
2
+ from .quests import quests
3
+ from .values import *
4
+
5
+ __all__ = [
6
+ "client",
7
+ "quests",
8
+ "genres"
9
+ ]
MeanderAPI/client.py ADDED
@@ -0,0 +1,25 @@
1
+ import requests, json
2
+ import webbrowser
3
+ from .auth import auth_code
4
+ from .auth import google_token
5
+ from .auth import meander_token
6
+
7
+ google_auth_url = (
8
+ "https://accounts.google.com/o/oauth2/v2/auth?"
9
+ "client_id=410112450155-mgd0ic4883lg6ic2e2ljrnipt6n2jrdc.apps.googleusercontent.com&"
10
+ "redirect_uri=http://localhost:61222&"
11
+ "response_type=code&"
12
+ "scope=openid%20email%20profile"
13
+ )
14
+
15
+ class client:
16
+ def new_guest():
17
+ return "NoToken"
18
+ def new_auth_by_token(token):
19
+ return token
20
+ def new_google_auth():
21
+ webbrowser.open(google_auth_url)
22
+ code = auth_code.get_code()
23
+ token = google_token.code_to_token(code)
24
+ token_meander = meander_token.get_token(token)
25
+ return token_meander
MeanderAPI/quests.py ADDED
@@ -0,0 +1,92 @@
1
+ import requests, json
2
+
3
+ class quests:
4
+ def get_quests(client):
5
+ headers = {
6
+ "Authorization": f"Bearer {client}",
7
+ "Content-Type": "application/json"
8
+ }
9
+
10
+ resp = requests.get("https://backend.meander.sbs/quests", headers=headers)
11
+ return resp.json()
12
+ def get_quest_by_id(client, quest_id):
13
+ headers = {
14
+ "Authorization": f"Bearer {client}",
15
+ "Content-Type": "application/json"
16
+ }
17
+
18
+ resp = requests.get("https://backend.meander.sbs/quests/" + quest_id, headers=headers)
19
+ return resp.json()
20
+ def download_quest(client, quest, path):
21
+ headers = {
22
+ "Authorization": f"Bearer {client}",
23
+ "Content-Type": "application/json"
24
+ }
25
+
26
+ quest_url = quest["download_url"]
27
+
28
+ resp = requests.get(quest_url, headers=headers)
29
+ with open(path, "wb") as f:
30
+ f.write(resp.content)
31
+ def get_quests_by_search(client, query=None, genre=None, author_id=None):
32
+ params = {}
33
+ if query:
34
+ params["search"] = query
35
+ if genre:
36
+ params["genre"] = genre
37
+ if author_id:
38
+ params["author_id"] = author_id
39
+ headers = {
40
+ "Authorization": f"Bearer {client}",
41
+ "Content-Type": "application/json"
42
+ }
43
+ resp = requests.get("https://backend.meander.sbs/quests", params=params, headers=headers)
44
+ return resp.json()
45
+
46
+ def like(client, quest):
47
+ headers = {
48
+ "Authorization": f"Bearer {client}",
49
+ "Content-Type": "application/json"
50
+ }
51
+ quest_id = quest["id"]
52
+ resp = requests.post(
53
+ f"https://backend.meander.sbs/quests/{quest_id}/vote",
54
+ headers=headers,
55
+ json={"action": "set", "is_like": True}
56
+ )
57
+ return resp.json()
58
+ def dislike(client, quest):
59
+ headers = {
60
+ "Authorization": f"Bearer {client}",
61
+ "Content-Type": "application/json"
62
+ }
63
+ quest_id = quest["id"]
64
+ resp = requests.post(
65
+ f"https://backend.meander.sbs/quests/{quest_id}/vote",
66
+ headers=headers,
67
+ json={"action": "set", "is_like": False}
68
+ )
69
+ return resp.json()
70
+ def unvote(client, quest):
71
+ headers = {
72
+ "Authorization": f"Bearer {client}",
73
+ "Content-Type": "application/json"
74
+ }
75
+ quest_id = quest["id"]
76
+ resp = requests.post(
77
+ f"https://backend.meander.sbs/quests/{quest_id}/vote",
78
+ headers=headers,
79
+ json={"action": "remove"}
80
+ )
81
+ return resp.json()
82
+ def get_my_vote(client, quest):
83
+ headers = {
84
+ "Authorization": f"Bearer {client}",
85
+ "Content-Type": "application/json"
86
+ }
87
+ quest_id = quest["id"]
88
+ resp = requests.get(
89
+ f"https://backend.meander.sbs/quests/{quest_id}/my-vote",
90
+ headers=headers
91
+ )
92
+ return resp.json()
MeanderAPI/values.py ADDED
@@ -0,0 +1,10 @@
1
+ class genres:
2
+ Historical = "Historical"
3
+ Adventure = "Adventure"
4
+ Comedy = "Comedy"
5
+ Thriller = "Thriller"
6
+ Drama = "Drama"
7
+ SciFi = "Sci-Fi"
8
+ Mystery = "Mystery"
9
+ Horror = "Horror"
10
+ Fantasy = "Fantasy"
@@ -0,0 +1,88 @@
1
+ Metadata-Version: 2.4
2
+ Name: meander-api
3
+ Version: 0.1.0
4
+ Summary: Unofficial Python API wrapper for Meander platform
5
+ Home-page: https://github.com/elitrycraft/MeanderAPI
6
+ Author: Deniz1111212
7
+ Author-email: elitrycraft@gmail.com
8
+ Project-URL: Bug Reports, https://github.com/elitrycraft/MeanderAPI/issues
9
+ Project-URL: Source, https://github.com/elitrycraft/MeanderAPI
10
+ Keywords: meander api wrapper quests
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: License :: OSI Approved :: MIT License
13
+ Classifier: Operating System :: OS Independent
14
+ Requires-Python: >=3.8
15
+ Description-Content-Type: text/markdown
16
+ Requires-Dist: requests>=2.25.0
17
+ Dynamic: author
18
+ Dynamic: author-email
19
+ Dynamic: classifier
20
+ Dynamic: description
21
+ Dynamic: description-content-type
22
+ Dynamic: home-page
23
+ Dynamic: keywords
24
+ Dynamic: project-url
25
+ Dynamic: requires-dist
26
+ Dynamic: requires-python
27
+ Dynamic: summary
28
+
29
+ # MeanderAPI
30
+
31
+ A python library for interact with Meander API
32
+ ---
33
+
34
+ ## Features
35
+
36
+ * Supports Google auth
37
+ * Get all quest list without auth
38
+ * Download quests without auth
39
+ * Auth by token
40
+
41
+ ---
42
+
43
+ # Install
44
+
45
+ ```bash
46
+ # soon
47
+ ```
48
+
49
+ ## Usage Example
50
+
51
+ Here is a comprehensive example demonstrating how to initialize the client, authenticate, browse quests, download them, and interact with the voting system.
52
+
53
+ ```python
54
+ from MeanderAPI import client, quests, genres
55
+
56
+ # Auth by token you can get it by using google auth
57
+ user = client.new_auth_by_token("MeanderToken")
58
+
59
+ # Guest mode
60
+ user = client.new_guest()
61
+
62
+ # Meander google auth
63
+ user = client.new_google_auth()
64
+
65
+ # Get all quests
66
+ print(quests.get_quests(user))
67
+
68
+ # Get quest by id
69
+ print(quests.get_quest_by_id(user, "ba0b5e8d-0d4f-4368-af9f-2564bc00c07d"))
70
+
71
+ # Download quest
72
+ quests.download_quest(user, quests.get_quest_by_id(user, "ba0b5e8d-0d4f-4368-af9f-2564bc00c07d"), r"C:\Users\Deniz\Desktop\MeanderAPI\mnd.mnd")
73
+
74
+ # Get quest by search
75
+ print(quests.get_quests_by_search(user, "test", genres.Adventure, "27ed560e-6a0f-4e67-bb7b-ce291e89f075"))
76
+
77
+ # Get my vote quest (Auth required)
78
+ print(quests.get_my_vote(user, quests.get_quest_by_id(user, "7915972f-92bb-4464-b14d-c1a279cd8a26")))
79
+
80
+ # Unvote quest (Auth required)
81
+ print(quests.unvote(user, quests.get_quest_by_id(user, "7915972f-92bb-4464-b14d-c1a279cd8a26")))
82
+
83
+ # Like quest (Auth required)
84
+ print(quests.like(user, quests.get_quest_by_id(user, "7915972f-92bb-4464-b14d-c1a279cd8a26")))
85
+
86
+ # Dislike quest (Auth required)
87
+ print(quests.dislike(user, quests.get_quest_by_id(user, "7915972f-92bb-4464-b14d-c1a279cd8a26")))
88
+ ```
@@ -0,0 +1,8 @@
1
+ MeanderAPI/__init__.py,sha256=RaCVlymP_Oguf2IQ6sFDklgBEarXBjtyn2UJv_1b-58,141
2
+ MeanderAPI/client.py,sha256=2V2vkA3SJoau2_SS6LP4Eb8Hu9YfzQZhRDQxapmda-8,780
3
+ MeanderAPI/quests.py,sha256=uKJkeZz6EOnLK4BL4UDLKCSuXK05e0aJt6uX3tE5ujg,3112
4
+ MeanderAPI/values.py,sha256=cJ1avt0bdKodfnwhyANdTnuqKByjA4F7Of2HJ49f7b0,241
5
+ meander_api-0.1.0.dist-info/METADATA,sha256=F83PHydfa-3eOcSSrQdLH0WDWtG4udZwH86d91Rp06c,2578
6
+ meander_api-0.1.0.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
7
+ meander_api-0.1.0.dist-info/top_level.txt,sha256=ZrU8b-PtLdj3DH5dpA8Q-L8AZtHDt_SaDV4tDdtTeOw,11
8
+ meander_api-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (82.0.1)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1 @@
1
+ MeanderAPI