-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmake_sample.py
More file actions
100 lines (81 loc) · 2.17 KB
/
make_sample.py
File metadata and controls
100 lines (81 loc) · 2.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
import base64
import requests
# Create Make Image API V3 Sample
# Powered by MaguRo 🐟 2024
# Key
key = ""
# Host ※ Do not change!
url = "http://{IP}/make"
# Text Draw
params = {
"key" : key,
"param" : "makemono2#c71585",
"name" : "MaguRo Kawaii",
"text" : "Hello MaguRo",
"id" : "0001112222",
"mid" : "u66aa785c06415da8850a19a6e16c223f12345",
"meta" : "None",
"stamp" : "None"
}
# Line-Emoji Draw
"""
params = {
"key" : "MaguRo04",
"param" : "make",
"name" : "まぐふぁよ",
"text" : "(emoji)(emoji)(emoji)",
"id" : "0001112222",
"mid" : "u66aa785c06415da8850a19a6e16c223f12345",
"meta" : str([{"productId":"631ebb54f1289d7e58de92e4","E":7,"resourceType":"STATIC","version":1,"sticonId":"030","S":0},{"productId":"631ebb54f1289d7e58de92e4","S":7,"E":14,"sticonId":"031","resourceType":"STATIC","version":1},{"E":21,"S":14,"resourceType":"STATIC","sticonId":"032","productId":"631ebb54f1289d7e58de92e4","version":1}]),
"stamp" : "None",
}
"""
# Line-Sticker Draw
"""
params = {
"key" : "MaguRo04",
"param" : "make",
"name" : "まぐふぁよ",
"text" : "",
"id" : "0001112222",
"mid" : "u66aa785c06415da8850a19a6e16c223f12345",
"meta" : "None",
"stamp" : "22395286_571129566",
}
"""
# Line-Combination-Sticker Draw
"""
params = {
"key" : "MaguRo04",
"param" : "make",
"name" : "まぐふぁよ",
"text" : "",
"id" : "0001112222",
"mid" : "u66aa785c06415da8850a19a6e16c223f12345",
"meta" : "None",
"stamp" : "28929124-7542-45e8-9d52-8df64de81584",
}
"""
# Icon image
file = {
"img": open("req.jpg", "rb")
}
# Request
try:
res = requests.post(url, params=params, files=file, timeout=60).json()
except requests.exceptions.ReadTimeout:
print("timeout")
exit()
# Result
if res["status"] == "error":
print(res["message"])
else:
with open("res.jpg", mode="wb") as f:
f.write(base64.b64decode(res["image"]))
# If gif supported
if "gif" in res:
with open("res.gif", mode="wb") as f:
f.write(base64.b64decode(res["gif"]))
print(res["message"])
# Show Results
#print(res)