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
244afcf2
Kaydet (Commit)
244afcf2
authored
Nis 22, 2015
tarafından
Facundo Batista
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #23887: urllib.error.HTTPError now has a proper repr() representation.
üst
d209d646
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
1 deletion
+9
-1
test_urllib2.py
Lib/test/test_urllib2.py
+0
-0
error.py
Lib/urllib/error.py
+6
-1
NEWS
Misc/NEWS
+3
-0
No files found.
Lib/test/test_urllib2.py
Dosyayı görüntüle @
244afcf2
This diff is collapsed.
Click to expand it.
Lib/urllib/error.py
Dosyayı görüntüle @
244afcf2
...
@@ -35,6 +35,7 @@ class URLError(OSError):
...
@@ -35,6 +35,7 @@ class URLError(OSError):
def
__str__
(
self
):
def
__str__
(
self
):
return
'<urlopen error
%
s>'
%
self
.
reason
return
'<urlopen error
%
s>'
%
self
.
reason
class
HTTPError
(
URLError
,
urllib
.
response
.
addinfourl
):
class
HTTPError
(
URLError
,
urllib
.
response
.
addinfourl
):
"""Raised when HTTP error occurs, but also acts like non-error return"""
"""Raised when HTTP error occurs, but also acts like non-error return"""
__super_init
=
urllib
.
response
.
addinfourl
.
__init__
__super_init
=
urllib
.
response
.
addinfourl
.
__init__
...
@@ -55,6 +56,9 @@ class HTTPError(URLError, urllib.response.addinfourl):
...
@@ -55,6 +56,9 @@ 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
)
def
__repr__
(
self
):
return
'<HTTPError
%
s:
%
r>'
%
(
self
.
code
,
self
.
msg
)
# since URLError specifies a .reason attribute, HTTPError should also
# since URLError specifies a .reason attribute, HTTPError should also
# provide this attribute. See issue13211 for discussion.
# provide this attribute. See issue13211 for discussion.
@property
@property
...
@@ -69,8 +73,9 @@ class HTTPError(URLError, urllib.response.addinfourl):
...
@@ -69,8 +73,9 @@ class HTTPError(URLError, urllib.response.addinfourl):
def
headers
(
self
,
headers
):
def
headers
(
self
,
headers
):
self
.
hdrs
=
headers
self
.
hdrs
=
headers
# exception raised when downloaded size does not match content-length
class
ContentTooShortError
(
URLError
):
class
ContentTooShortError
(
URLError
):
"""Exception raised when downloaded size does not match content-length."""
def
__init__
(
self
,
message
,
content
):
def
__init__
(
self
,
message
,
content
):
URLError
.
__init__
(
self
,
message
)
URLError
.
__init__
(
self
,
message
)
self
.
content
=
content
self
.
content
=
content
Misc/NEWS
Dosyayı görüntüle @
244afcf2
...
@@ -33,6 +33,9 @@ Library
...
@@ -33,6 +33,9 @@ Library
-
Issue
#
23728
:
binascii
.
crc_hqx
()
could
return
an
integer
outside
of
the
range
-
Issue
#
23728
:
binascii
.
crc_hqx
()
could
return
an
integer
outside
of
the
range
0
-
0xffff
for
empty
data
.
0
-
0xffff
for
empty
data
.
-
Issue
#
23887
:
urllib
.
error
.
HTTPError
now
has
a
proper
repr
()
representation
.
Patch
by
Berker
Peksag
.
What
's New in Python 3.5.0 alpha 4?
What
's New in Python 3.5.0 alpha 4?
===================================
===================================
...
...
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