Postingan lainnya
Mechanize di python
from mechanize import Browser
browser = Browser()
response = browser.open('http://www.google.com')
print (response.code)
Hasil kode diatas:
Traceback (most recent call last):
File "d:\Tutorial Python\10 - Project Saya\Non OOP\04_Mechanize.py", line 3, in <module>
response = browser.open('http://www.google.com')
File "C:\Users\acer\AppData\Local\Programs\Python\Python39\lib\site-packages\mechanize\_mechanize.py", line 257, in open
return self._mech_open(url_or_request, data, timeout=timeout)
File "C:\Users\acer\AppData\Local\Programs\Python\Python39\lib\site-packages\mechanize\_mechanize.py", line 313, in _mech_open
raise response
mechanize._response.httperror_seek_wrapper: HTTP Error 403: b'request disallowed by robots.txt'
PS D:\Tutorial Python>
Dimana letak kesalahannya dan bagaimana supaya kode nya benar?
Saya masih belum paham betul tentang library mechanize di python.
Mohon dijawab ya teman teman
0
1 Jawaban:
<div>kalau melihat errornya </div><pre>: HTTP Error 403: b'request disallowed by robots.txt'</pre><div><br>mungkin dari websitenya sudah mencegah, tidak bisa dibuka via ini.<br>Coba website lain seperti github.com , etc...</div>
1
Tanggapan
ok,sdh bisa bg.Terima kasih