Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
1a413136
Kaydet (Commit)
1a413136
authored
Agu 28, 2007
tarafından
Skip Montanaro
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
fixes 813986
üst
bf138333
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
0 deletions
+16
-0
robotparser.py
Lib/robotparser.py
+5
-0
test_robotparser.py
Lib/test/test_robotparser.py
+11
-0
No files found.
Lib/robotparser.py
Dosyayı görüntüle @
1a413136
...
@@ -230,6 +230,11 @@ class URLopener(urllib.FancyURLopener):
...
@@ -230,6 +230,11 @@ class URLopener(urllib.FancyURLopener):
urllib
.
FancyURLopener
.
__init__
(
self
,
*
args
)
urllib
.
FancyURLopener
.
__init__
(
self
,
*
args
)
self
.
errcode
=
200
self
.
errcode
=
200
def
prompt_user_passwd
(
self
,
host
,
realm
):
## If robots.txt file is accessible only with a password,
## we act as if the file wasn't there.
return
None
,
None
def
http_error_default
(
self
,
url
,
fp
,
errcode
,
errmsg
,
headers
):
def
http_error_default
(
self
,
url
,
fp
,
errcode
,
errmsg
,
headers
):
self
.
errcode
=
errcode
self
.
errcode
=
errcode
return
urllib
.
FancyURLopener
.
http_error_default
(
self
,
url
,
fp
,
errcode
,
return
urllib
.
FancyURLopener
.
http_error_default
(
self
,
url
,
fp
,
errcode
,
...
...
Lib/test/test_robotparser.py
Dosyayı görüntüle @
1a413136
...
@@ -134,8 +134,19 @@ bad = [] # Bug report says "/" should be denied, but that is not in the RFC
...
@@ -134,8 +134,19 @@ bad = [] # Bug report says "/" should be denied, but that is not in the RFC
RobotTest
(
7
,
doc
,
good
,
bad
)
RobotTest
(
7
,
doc
,
good
,
bad
)
class
TestCase
(
unittest
.
TestCase
):
def
runTest
(
self
):
test_support
.
requires
(
'network'
)
# whole site is password-protected.
url
=
'http://mueblesmoraleda.com'
parser
=
robotparser
.
RobotFileParser
()
parser
.
set_url
(
url
)
parser
.
read
()
self
.
assertEqual
(
parser
.
can_fetch
(
"*"
,
url
+
"/robots.txt"
),
False
)
def
test_main
():
def
test_main
():
test_support
.
run_unittest
(
tests
)
test_support
.
run_unittest
(
tests
)
TestCase
()
.
run
()
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
test_support
.
Verbose
=
1
test_support
.
Verbose
=
1
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment