回答編集履歴

2

些細

2019/04/11 03:33

投稿

quickquip
quickquip

スコア11038

test CHANGED
@@ -14,7 +14,7 @@
14
14
 
15
15
 
16
16
 
17
- [http://docs.python-requests.org/en/master/api/?highlight=ok#requests.Response.ok](http://docs.python-requests.org/en/master/api/?highlight=ok#requests.Response.ok)
17
+ [http://docs.python-requests.org/en/master/api/#requests.Response.ok](http://docs.python-requests.org/en/master/api/#requests.Response.ok)
18
18
 
19
19
 
20
20
 
@@ -24,7 +24,7 @@
24
24
 
25
25
 
26
26
 
27
- [http://docs.python-requests.org/en/master/api/?highlight=ok#requests.Response.status_code](http://docs.python-requests.org/en/master/api/?highlight=ok#requests.Response.status_code)
27
+ [http://docs.python-requests.org/en/master/api/#requests.Response.status_code](http://docs.python-requests.org/en/master/api/#requests.Response.status_code)
28
28
 
29
29
 
30
30
 

1

status_codeのチェックを書き直しました。

2019/04/11 03:33

投稿

quickquip
quickquip

スコア11038

test CHANGED
@@ -18,6 +18,22 @@
18
18
 
19
19
 
20
20
 
21
+ (追記)
22
+
23
+ すみません。リンクに This is not a check to see if the response code is 200 OK. と書いてありますね。status_code をチェックしてください。
24
+
25
+
26
+
27
+ [http://docs.python-requests.org/en/master/api/?highlight=ok#requests.Response.status_code](http://docs.python-requests.org/en/master/api/?highlight=ok#requests.Response.status_code)
28
+
29
+
30
+
31
+ こちらですね。
32
+
33
+
34
+
35
+
36
+
21
37
  ----
22
38
 
23
39
 
@@ -28,7 +44,7 @@
28
44
 
29
45
  ```python
30
46
 
31
- if response.ok:
47
+ if response.status_code == requests.codes.ok:
32
48
 
33
49
  # ここは正常なケース
34
50