質問編集履歴
2
質問を修正する。
title
CHANGED
|
File without changes
|
body
CHANGED
|
@@ -32,6 +32,6 @@
|
|
|
32
32
|
service_execute(7)
|
|
33
33
|
|
|
34
34
|
・エラー箇所
|
|
35
|
-
reqdata = request.decode()
|
|
35
|
+
reqdata = request.decode('utf-8')
|
|
36
36
|
AttributeError: 'str' object has no attribute 'decode'
|
|
37
37
|
```
|
1
質問の修正
title
CHANGED
|
File without changes
|
body
CHANGED
|
@@ -4,13 +4,33 @@
|
|
|
4
4
|
現象の意味がまだ分かっていないのですが、
|
|
5
5
|
なぜ起きるのでしょうか。
|
|
6
6
|
requestに入力する適切な辞書型の書き方は分かりますか。
|
|
7
|
+
C:\Users\pcuser\source_code\kensaku_project\flont_sub_jikkouy\app\search\api\apiexecute_test.py
|
|
8
|
+
上記で、コマンドから[python apiexecute_test.py]を実行しました。
|
|
7
9
|
|
|
8
10
|
```ここに言語を入力
|
|
9
|
-
・
|
|
11
|
+
・apiexecute_test.py
|
|
12
|
+
import json
|
|
13
|
+
|
|
14
|
+
def service_execute(function_id):
|
|
15
|
+
request_data = get_request_data()
|
|
16
|
+
|
|
17
|
+
# リクエストデータを取得する
|
|
18
|
+
def get_request_data():
|
|
19
|
+
|
|
20
|
+
request_data = get_request_data_body()
|
|
21
|
+
|
|
22
|
+
return request_data
|
|
23
|
+
|
|
10
24
|
def get_request_data_body():
|
|
11
25
|
# JSON固定 バイナリ等受け取る場合は処理を分ける
|
|
12
|
-
request = {"level":3,"
|
|
26
|
+
request = {"level":3,"parent_address_code":"01#101"}
|
|
13
27
|
reqdata = request.decode('utf-8')
|
|
28
|
+
reqdata_dic = json.loads(reqdata)
|
|
29
|
+
return reqdata_dic
|
|
30
|
+
|
|
31
|
+
if __name__ == "__main__":
|
|
32
|
+
service_execute(7)
|
|
33
|
+
|
|
14
34
|
・エラー箇所
|
|
15
35
|
reqdata = request.decode()
|
|
16
36
|
AttributeError: 'str' object has no attribute 'decode'
|