-
Notifications
You must be signed in to change notification settings - Fork 0
/
testing.py
112 lines (107 loc) · 3.18 KB
/
testing.py
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
101
102
103
104
105
106
107
108
109
110
111
112
import requests
import json
objPpttc = [
{
"template": "https://storage.googleapis.com/example_bucekt/template.pptx",
"data": [
{
"name": "Chart1",
"table": [
[
{
"string": "Category"
},
{
"string": "1"
},
{
"string": "0"
}
],
[
None,
None,
None
],
[
{
"string": "0"
},
{
"number": 27,
"fill": "#d0d0d0"
},
{
"number": 38,
"fill": "#d0d0d0"
}
],
[
{
"string": "1"
},
{
"number": 9,
"fill": "#aae6f0"
},
{
"number": 14,
"fill": "#aae6f0"
}
],
[
{
"string": "2"
},
{
"number": 10,
"fill": "#00a9f4"
},
{
"number": 7,
"fill": "#00a9f4"
}
],
[
{
"string": "3"
},
{
"number": 3,
"fill": "#027ab1"
},
{
"number": 0,
"fill": "#027ab1"
}
],
[
{
"string": "4"
},
{
"number": 5,
"fill": "#034b6f"
},
{
"number": 0,
"fill": "#034b6f"
}
]
]
}
]
}
]
headers = {
'Content-Type': 'application/vnd.think-cell.ppttc+json'
}
response = requests.post('http://127.0.0.1:8081', headers=headers, data=json.dumps(objPpttc))
if response.status_code == 200:
with open('sample.pptx', 'wb') as f:
f.write(response.content)
print("Success.")
else:
print(f"Failed with status code: {response.status_code}")
# print(response)
print(response.text)