質問編集履歴
6
変更:requests.postの引数のparamsをdataに変更
test
CHANGED
File without changes
|
test
CHANGED
@@ -28,7 +28,7 @@
|
|
28
28
|
|
29
29
|
header = {"Content-Type": "application/x-www-form-urlencoded"}
|
30
30
|
|
31
|
-
res = requests.post(url=endpoint,
|
31
|
+
res = requests.post(url=endpoint, data=payload, headers=header)
|
32
32
|
|
33
33
|
print(res.status_code)
|
34
34
|
|
5
パラメータに無駄な文字があったので削除
test
CHANGED
File without changes
|
test
CHANGED
@@ -22,7 +22,7 @@
|
|
22
22
|
|
23
23
|
|
24
24
|
|
25
|
-
payload = {"grant_type": "refresh_token", "refresh_token": config.refresh_token
|
25
|
+
payload = {"grant_type": "refresh_token", "refresh_token": config.refresh_token, "client_id": config.client_id,
|
26
26
|
|
27
27
|
"client_secret": config.client_secret, "scope": self.__scope, "redirect_uri": self.__redirect_url}
|
28
28
|
|
4
追加:#content,#textの追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -83,3 +83,45 @@
|
|
83
83
|
# 自分で調べたこと
|
84
84
|
|
85
85
|
`res.request.body`でBodyの中身を確認した所`None`でした。この場合何がいけないんでしょうか?因みに、ツールの方でhttpリクエストは成功して、トークンを取得できてます。
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
---
|
90
|
+
|
91
|
+
長いので省略してます
|
92
|
+
|
93
|
+
`print(res.content)`
|
94
|
+
|
95
|
+
```
|
96
|
+
|
97
|
+
b'\r\n\r\n<!DOCTYPE html>\r\n<html dir="ltr" class="" lang="en">\r\n<head>\r\n <title>Sign in to your account</title>\r\n
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
```
|
102
|
+
|
103
|
+
---
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
`print(res.text)`
|
108
|
+
|
109
|
+
|
110
|
+
|
111
|
+
```python
|
112
|
+
|
113
|
+
|
114
|
+
|
115
|
+
|
116
|
+
|
117
|
+
|
118
|
+
|
119
|
+
<!DOCTYPE html>
|
120
|
+
|
121
|
+
<html dir="ltr" class="" lang="en">
|
122
|
+
|
123
|
+
<head>
|
124
|
+
|
125
|
+
<title>Sign in to your account</title>
|
126
|
+
|
127
|
+
```
|
3
情報追加:Bodyの中身がなかったこと
test
CHANGED
File without changes
|
test
CHANGED
@@ -77,3 +77,9 @@
|
|
77
77
|
|
78
78
|
|
79
79
|
```
|
80
|
+
|
81
|
+
|
82
|
+
|
83
|
+
# 自分で調べたこと
|
84
|
+
|
85
|
+
`res.request.body`でBodyの中身を確認した所`None`でした。この場合何がいけないんでしょうか?因みに、ツールの方でhttpリクエストは成功して、トークンを取得できてます。
|
2
エラー発生個所を明確に記入
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# 発生しているエラー
|
2
2
|
|
3
|
-
`requests#post()#json()`で`json.decoder.JSONDecodeError`が発生します。
|
3
|
+
`requests#post()#json()`で`json.decoder.JSONDecodeError`が発生します。(`res.json()`でエラーが発生)
|
4
4
|
|
5
5
|
|
6
6
|
|
1
初心者マークを付けました
test
CHANGED
File without changes
|
test
CHANGED
File without changes
|