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
0612e8c2
Kaydet (Commit)
0612e8c2
authored
Ara 03, 2011
tarafından
Jason R. Coombs
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
Merged fix for #13211 from 3.2
üst
c9b644ea
aa204dbe
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
0 deletions
+17
-0
test_urllib2.py
Lib/test/test_urllib2.py
+11
-0
error.py
Lib/urllib/error.py
+6
-0
No files found.
Lib/test/test_urllib2.py
Dosyayı görüntüle @
0612e8c2
...
@@ -1449,6 +1449,17 @@ class RequestTests(unittest.TestCase):
...
@@ -1449,6 +1449,17 @@ class RequestTests(unittest.TestCase):
req
=
Request
(
url
)
req
=
Request
(
url
)
self
.
assertEqual
(
req
.
get_full_url
(),
url
)
self
.
assertEqual
(
req
.
get_full_url
(),
url
)
def
test_HTTPError_interface
():
"""
Issue 13211 reveals that HTTPError didn't implement the URLError
interface even though HTTPError is a subclass of URLError.
>>> err = urllib.error.HTTPError(msg='something bad happened', url=None, code=None, hdrs=None, fp=None)
>>> assert hasattr(err, 'reason')
>>> err.reason
'something bad happened'
"""
def
test_main
(
verbose
=
None
):
def
test_main
(
verbose
=
None
):
from
test
import
test_urllib2
from
test
import
test_urllib2
support
.
run_doctest
(
test_urllib2
,
verbose
)
support
.
run_doctest
(
test_urllib2
,
verbose
)
...
...
Lib/urllib/error.py
Dosyayı görüntüle @
0612e8c2
...
@@ -55,6 +55,12 @@ class HTTPError(URLError, urllib.response.addinfourl):
...
@@ -55,6 +55,12 @@ class HTTPError(URLError, urllib.response.addinfourl):
def
__str__
(
self
):
def
__str__
(
self
):
return
'HTTP Error
%
s:
%
s'
%
(
self
.
code
,
self
.
msg
)
return
'HTTP Error
%
s:
%
s'
%
(
self
.
code
,
self
.
msg
)
# since URLError specifies a .reason attribute, HTTPError should also
# provide this attribute. See issue13211 for discussion.
@property
def
reason
(
self
):
return
self
.
msg
# exception raised when downloaded size does not match content-length
# exception raised when downloaded size does not match content-length
class
ContentTooShortError
(
URLError
):
class
ContentTooShortError
(
URLError
):
def
__init__
(
self
,
message
,
content
):
def
__init__
(
self
,
message
,
content
):
...
...
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