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
34d38dce
Kaydet (Commit)
34d38dce
authored
Eki 19, 2011
tarafından
Senthil Kumaran
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
urllib.request - syntax changes enhancing readability. By Éric Araujo
üst
202a3c42
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
11 deletions
+10
-11
request.py
Lib/urllib/request.py
+10
-11
No files found.
Lib/urllib/request.py
Dosyayı görüntüle @
34d38dce
...
@@ -552,12 +552,11 @@ class HTTPRedirectHandler(BaseHandler):
...
@@ -552,12 +552,11 @@ class HTTPRedirectHandler(BaseHandler):
# For security reasons we don't allow redirection to anything other
# For security reasons we don't allow redirection to anything other
# than http, https or ftp.
# than http, https or ftp.
if
not
urlparts
.
scheme
in
(
'http'
,
'https'
,
'ftp'
):
if
urlparts
.
scheme
not
in
(
'http'
,
'https'
,
'ftp'
):
raise
HTTPError
(
newurl
,
code
,
raise
HTTPError
(
msg
+
newurl
,
code
,
" - Redirection to url '
%
s' is not allowed"
%
"
%
s - Redirection to url '
%
s' is not allowed"
%
(
msg
,
newurl
),
newurl
,
headers
,
fp
)
headers
,
fp
)
if
not
urlparts
.
path
:
if
not
urlparts
.
path
:
urlparts
=
list
(
urlparts
)
urlparts
=
list
(
urlparts
)
...
@@ -722,7 +721,7 @@ class HTTPPasswordMgr:
...
@@ -722,7 +721,7 @@ class HTTPPasswordMgr:
# uri could be a single URI or a sequence
# uri could be a single URI or a sequence
if
isinstance
(
uri
,
str
):
if
isinstance
(
uri
,
str
):
uri
=
[
uri
]
uri
=
[
uri
]
if
not
realm
in
self
.
passwd
:
if
realm
not
in
self
.
passwd
:
self
.
passwd
[
realm
]
=
{}
self
.
passwd
[
realm
]
=
{}
for
default_port
in
True
,
False
:
for
default_port
in
True
,
False
:
reduced_uri
=
tuple
(
reduced_uri
=
tuple
(
...
@@ -1823,7 +1822,7 @@ class URLopener:
...
@@ -1823,7 +1822,7 @@ class URLopener:
del
self
.
ftpcache
[
k
]
del
self
.
ftpcache
[
k
]
v
.
close
()
v
.
close
()
try
:
try
:
if
not
key
in
self
.
ftpcache
:
if
key
not
in
self
.
ftpcache
:
self
.
ftpcache
[
key
]
=
\
self
.
ftpcache
[
key
]
=
\
ftpwrapper
(
user
,
passwd
,
host
,
port
,
dirs
)
ftpwrapper
(
user
,
passwd
,
host
,
port
,
dirs
)
if
not
file
:
type
=
'D'
if
not
file
:
type
=
'D'
...
@@ -1938,7 +1937,7 @@ class FancyURLopener(URLopener):
...
@@ -1938,7 +1937,7 @@ class FancyURLopener(URLopener):
# We are using newer HTTPError with older redirect_internal method
# We are using newer HTTPError with older redirect_internal method
# This older method will get deprecated in 3.3
# This older method will get deprecated in 3.3
if
not
urlparts
.
scheme
in
(
'http'
,
'https'
,
'ftp'
):
if
urlparts
.
scheme
not
in
(
'http'
,
'https'
,
'ftp'
):
raise
HTTPError
(
newurl
,
errcode
,
raise
HTTPError
(
newurl
,
errcode
,
errmsg
+
errmsg
+
" Redirection to url '
%
s' is not allowed."
%
newurl
,
" Redirection to url '
%
s' is not allowed."
%
newurl
,
...
@@ -1965,7 +1964,7 @@ class FancyURLopener(URLopener):
...
@@ -1965,7 +1964,7 @@ class FancyURLopener(URLopener):
retry
=
False
):
retry
=
False
):
"""Error 401 -- authentication required.
"""Error 401 -- authentication required.
This function supports Basic authentication only."""
This function supports Basic authentication only."""
if
not
'www-authenticate'
in
headers
:
if
'www-authenticate'
not
in
headers
:
URLopener
.
http_error_default
(
self
,
url
,
fp
,
URLopener
.
http_error_default
(
self
,
url
,
fp
,
errcode
,
errmsg
,
headers
)
errcode
,
errmsg
,
headers
)
stuff
=
headers
[
'www-authenticate'
]
stuff
=
headers
[
'www-authenticate'
]
...
@@ -1991,7 +1990,7 @@ class FancyURLopener(URLopener):
...
@@ -1991,7 +1990,7 @@ class FancyURLopener(URLopener):
retry
=
False
):
retry
=
False
):
"""Error 407 -- proxy authentication required.
"""Error 407 -- proxy authentication required.
This function supports Basic authentication only."""
This function supports Basic authentication only."""
if
not
'proxy-authenticate'
in
headers
:
if
'proxy-authenticate'
not
in
headers
:
URLopener
.
http_error_default
(
self
,
url
,
fp
,
URLopener
.
http_error_default
(
self
,
url
,
fp
,
errcode
,
errmsg
,
headers
)
errcode
,
errmsg
,
headers
)
stuff
=
headers
[
'proxy-authenticate'
]
stuff
=
headers
[
'proxy-authenticate'
]
...
...
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