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
0a0fc07d
Kaydet (Commit)
0a0fc07d
authored
Tem 29, 2010
tarafından
Georg Brandl
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
#4108: the first default entry (User-agent: *) wins.
üst
70120e20
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
2 deletions
+21
-2
test_robotparser.py
Lib/test/test_robotparser.py
+14
-0
robotparser.py
Lib/urllib/robotparser.py
+4
-2
NEWS
Misc/NEWS
+3
-0
No files found.
Lib/test/test_robotparser.py
Dosyayı görüntüle @
0a0fc07d
...
...
@@ -216,6 +216,20 @@ bad = ['/some/path?name=value']
RobotTest
(
14
,
doc
,
good
,
bad
)
# 15. For issue #4108 (obey first * entry)
doc
=
"""
User-agent: *
Disallow: /some/path
User-agent: *
Disallow: /another/path
"""
good
=
[
'/another/path'
]
bad
=
[
'/some/path'
]
RobotTest
(
15
,
doc
,
good
,
bad
)
class
NetworkTestCase
(
unittest
.
TestCase
):
...
...
Lib/urllib/robotparser.py
Dosyayı görüntüle @
0a0fc07d
...
...
@@ -66,7 +66,9 @@ class RobotFileParser:
def
_add_entry
(
self
,
entry
):
if
"*"
in
entry
.
useragents
:
# the default entry is considered last
self
.
default_entry
=
entry
if
self
.
default_entry
is
None
:
# the first default entry wins
self
.
default_entry
=
entry
else
:
self
.
entries
.
append
(
entry
)
...
...
@@ -118,7 +120,7 @@ class RobotFileParser:
entry
.
rulelines
.
append
(
RuleLine
(
line
[
1
],
True
))
state
=
2
if
state
==
2
:
self
.
entries
.
append
(
entry
)
self
.
_add_entry
(
entry
)
def
can_fetch
(
self
,
useragent
,
url
):
...
...
Misc/NEWS
Dosyayı görüntüle @
0a0fc07d
...
...
@@ -475,6 +475,9 @@ C-API
Library
-------
- Issue #4108: In urllib.robotparser, if there are multiple 'User-agent: *'
entries, consider the first one.
- Issue #6630: Allow customizing regex flags when subclassing the
string.Template class.
...
...
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