質問編集履歴
2
test
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,7 +1,3 @@
|
|
1
|
-
http://www.atpworldtour.comというサイトのHTMLを表示しようと
|
2
|
-
|
3
|
-
|
4
|
-
|
5
1
|
def url_to_html(url):
|
6
2
|
|
7
3
|
res = urllib.request.urlopen(url)
|
@@ -11,47 +7,3 @@
|
|
11
7
|
html = data.decode("utf-8")
|
12
8
|
|
13
9
|
return html
|
14
|
-
|
15
|
-
というコードでhtmlを返り値としたプログラムを動かしたところ
|
16
|
-
|
17
|
-
以下のようなエラーコードが表示されました
|
18
|
-
|
19
|
-
対策お分かりの方お力添えお願いいたします
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
Traceback (most recent call last):
|
24
|
-
|
25
|
-
File "geps.py", line 46, in <module>
|
26
|
-
|
27
|
-
print(str(url_to_html(temp)))
|
28
|
-
|
29
|
-
File "geps.py", line 14, in url_to_html
|
30
|
-
|
31
|
-
res = urllib.request.urlopen(url)
|
32
|
-
|
33
|
-
File "/Users/fuji/.pyenv/versions/3.6.1/lib/python3.6/urllib/request.py", line 223, in urlopen
|
34
|
-
|
35
|
-
return opener.open(url, data, timeout)
|
36
|
-
|
37
|
-
File "/Users/fuji/.pyenv/versions/3.6.1/lib/python3.6/urllib/request.py", line 532, in open
|
38
|
-
|
39
|
-
response = meth(req, response)
|
40
|
-
|
41
|
-
File "/Users/fuji/.pyenv/versions/3.6.1/lib/python3.6/urllib/request.py", line 642, in http_response
|
42
|
-
|
43
|
-
'http', request, response, code, msg, hdrs)
|
44
|
-
|
45
|
-
File "/Users/fuji/.pyenv/versions/3.6.1/lib/python3.6/urllib/request.py", line 570, in error
|
46
|
-
|
47
|
-
return self._call_chain(*args)
|
48
|
-
|
49
|
-
File "/Users/fuji/.pyenv/versions/3.6.1/lib/python3.6/urllib/request.py", line 504, in _call_chain
|
50
|
-
|
51
|
-
result = func(*args)
|
52
|
-
|
53
|
-
File "/Users/fuji/.pyenv/versions/3.6.1/lib/python3.6/urllib/request.py", line 650, in http_error_default
|
54
|
-
|
55
|
-
raise HTTPError(req.full_url, code, msg, hdrs, fp)
|
56
|
-
|
57
|
-
urllib.error.HTTPError: HTTP Error 403: Forbidden
|
1
特になし
test
CHANGED
File without changes
|
test
CHANGED
@@ -30,27 +30,27 @@
|
|
30
30
|
|
31
31
|
res = urllib.request.urlopen(url)
|
32
32
|
|
33
|
-
File "/Users/fuji
|
33
|
+
File "/Users/fuji/.pyenv/versions/3.6.1/lib/python3.6/urllib/request.py", line 223, in urlopen
|
34
34
|
|
35
35
|
return opener.open(url, data, timeout)
|
36
36
|
|
37
|
-
File "/Users/fuji
|
37
|
+
File "/Users/fuji/.pyenv/versions/3.6.1/lib/python3.6/urllib/request.py", line 532, in open
|
38
38
|
|
39
39
|
response = meth(req, response)
|
40
40
|
|
41
|
-
File "/Users/fuji
|
41
|
+
File "/Users/fuji/.pyenv/versions/3.6.1/lib/python3.6/urllib/request.py", line 642, in http_response
|
42
42
|
|
43
43
|
'http', request, response, code, msg, hdrs)
|
44
44
|
|
45
|
-
File "/Users/fuji
|
45
|
+
File "/Users/fuji/.pyenv/versions/3.6.1/lib/python3.6/urllib/request.py", line 570, in error
|
46
46
|
|
47
47
|
return self._call_chain(*args)
|
48
48
|
|
49
|
-
File "/Users/fuji
|
49
|
+
File "/Users/fuji/.pyenv/versions/3.6.1/lib/python3.6/urllib/request.py", line 504, in _call_chain
|
50
50
|
|
51
51
|
result = func(*args)
|
52
52
|
|
53
|
-
File "/Users/fuji
|
53
|
+
File "/Users/fuji/.pyenv/versions/3.6.1/lib/python3.6/urllib/request.py", line 650, in http_error_default
|
54
54
|
|
55
55
|
raise HTTPError(req.full_url, code, msg, hdrs, fp)
|
56
56
|
|