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
5962cce0
Kaydet (Commit)
5962cce0
authored
Ara 10, 2012
tarafından
Senthil Kumaran
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fix Issue15701 : add .headers attribute to urllib.error.HTTPError
üst
8e5a8296
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
1 deletion
+23
-1
urllib.error.rst
Doc/library/urllib.error.rst
+7
-0
test_urllib2.py
Lib/test/test_urllib2.py
+5
-1
error.py
Lib/urllib/error.py
+8
-0
NEWS
Misc/NEWS
+3
-0
No files found.
Doc/library/urllib.error.rst
Dosyayı görüntüle @
5962cce0
...
...
@@ -45,6 +45,13 @@ The following exceptions are raised by :mod:`urllib.error` as appropriate:
This is usually a string explaining the reason for this error.
.. attribute:: headers
The HTTP response headers for the HTTP request that cause the
:exc:`HTTPError`.
.. versionadded:: 3.4
.. exception:: ContentTooShortError(msg, content)
This exception is raised when the :func:`urlretrieve` function detects that
...
...
Lib/test/test_urllib2.py
Dosyayı görüntüle @
5962cce0
...
...
@@ -1539,11 +1539,15 @@ def test_HTTPError_interface():
interface even though HTTPError is a subclass of URLError.
>>> msg = 'something bad happened'
>>> url = code = hdrs = fp = None
>>> url = code = fp = None
>>> hdrs = 'Content-Length: 42'
>>> err = urllib.error.HTTPError(url, code, msg, hdrs, fp)
>>> assert hasattr(err, 'reason')
>>> err.reason
'something bad happened'
>>> assert hasattr(err, 'headers')
>>> err.headers
'Content-Length: 42'
"""
def
test_main
(
verbose
=
None
):
...
...
Lib/urllib/error.py
Dosyayı görüntüle @
5962cce0
...
...
@@ -61,6 +61,14 @@ class HTTPError(URLError, urllib.response.addinfourl):
def
reason
(
self
):
return
self
.
msg
@property
def
headers
(
self
):
return
self
.
hdrs
@headers.setter
def
headers
(
self
,
headers
):
self
.
hdrs
=
headers
# exception raised when downloaded size does not match content-length
class
ContentTooShortError
(
URLError
):
def
__init__
(
self
,
message
,
content
):
...
...
Misc/NEWS
Dosyayı görüntüle @
5962cce0
...
...
@@ -163,6 +163,9 @@ Core and Builtins
Library
-------
- Issue #15701: Add a .headers attribute to urllib.error.HTTPError. Patch
contributed by Berker Peksag.
- Issue #15872: Fix 3.3 regression introduced by the new fd-based shutil.rmtree
that caused it to not ignore certain errors when ignore_errors was set.
Patch by Alessandro Moura and Serhiy Storchaka.
...
...
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