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
01fe5fa8
Kaydet (Commit)
01fe5fa8
authored
Tem 08, 2012
tarafından
Senthil Kumaran
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fix issue14826 - make urllib.request.Request quoted url consistent with URLOpener open method.
Patch contributed by Stephen Thorne.
üst
5356af8c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
2 deletions
+14
-2
test_urllib2.py
Lib/test/test_urllib2.py
+6
-0
urllib2.py
Lib/urllib2.py
+3
-2
NEWS
Misc/NEWS
+5
-0
No files found.
Lib/test/test_urllib2.py
Dosyayı görüntüle @
01fe5fa8
...
@@ -1325,6 +1325,12 @@ class RequestTests(unittest.TestCase):
...
@@ -1325,6 +1325,12 @@ class RequestTests(unittest.TestCase):
req
=
Request
(
"<URL:http://www.python.org>"
)
req
=
Request
(
"<URL:http://www.python.org>"
)
self
.
assertEqual
(
"www.python.org"
,
req
.
get_host
())
self
.
assertEqual
(
"www.python.org"
,
req
.
get_host
())
def
test_quoted_full_url
(
self
):
Request
=
urllib2
.
Request
request
=
Request
(
'http://www.python.org/foo bar'
)
self
.
assertEqual
(
request
.
get_full_url
(),
'http://www.python.org/foo
%20
bar'
)
def
test_url_fragment
(
self
):
def
test_url_fragment
(
self
):
req
=
Request
(
"http://www.python.org/?qs=query#fragment=true"
)
req
=
Request
(
"http://www.python.org/?qs=query#fragment=true"
)
self
.
assertEqual
(
"/?qs=query"
,
req
.
get_selector
())
self
.
assertEqual
(
"/?qs=query"
,
req
.
get_selector
())
...
...
Lib/urllib2.py
Dosyayı görüntüle @
01fe5fa8
...
@@ -110,7 +110,7 @@ except ImportError:
...
@@ -110,7 +110,7 @@ except ImportError:
from
StringIO
import
StringIO
from
StringIO
import
StringIO
from
urllib
import
(
unwrap
,
unquote
,
splittype
,
splithost
,
quote
,
from
urllib
import
(
unwrap
,
unquote
,
splittype
,
splithost
,
quote
,
addinfourl
,
splitport
,
splittag
,
addinfourl
,
splitport
,
splittag
,
toBytes
,
splitattr
,
ftpwrapper
,
splituser
,
splitpasswd
,
splitvalue
)
splitattr
,
ftpwrapper
,
splituser
,
splitpasswd
,
splitvalue
)
# support for FileHandler, proxies via environment variables
# support for FileHandler, proxies via environment variables
...
@@ -196,7 +196,8 @@ class Request:
...
@@ -196,7 +196,8 @@ class Request:
def
__init__
(
self
,
url
,
data
=
None
,
headers
=
{},
def
__init__
(
self
,
url
,
data
=
None
,
headers
=
{},
origin_req_host
=
None
,
unverifiable
=
False
):
origin_req_host
=
None
,
unverifiable
=
False
):
# unwrap('<URL:type://host/path>') --> 'type://host/path'
# unwrap('<URL:type://host/path>') --> 'type://host/path'
self
.
__original
=
unwrap
(
url
)
self
.
__original
=
unwrap
(
toBytes
(
url
))
self
.
__original
=
quote
(
self
.
__original
,
safe
=
"
%
/:=&?~#+!$,;'@()*[]|"
)
self
.
__original
,
self
.
__fragment
=
splittag
(
self
.
__original
)
self
.
__original
,
self
.
__fragment
=
splittag
(
self
.
__original
)
self
.
type
=
None
self
.
type
=
None
# self.__r_type is what's left after doing the splittype
# self.__r_type is what's left after doing the splittype
...
...
Misc/NEWS
Dosyayı görüntüle @
01fe5fa8
...
@@ -84,6 +84,11 @@ Core and Builtins
...
@@ -84,6 +84,11 @@ Core and Builtins
Library
Library
-------
-------
- Issue #14826: Quote urls in urllib2.Request identically to how they
are quoted by urllib.URLopener. Allows urls to spaces in them to work
transparently with urllib.request.urlopen(...). Patch contributed by Stephen
Thorne.
- Issue #15247: FileIO now raises an error when given a file descriptor
- Issue #15247: FileIO now raises an error when given a file descriptor
pointing to a directory.
pointing to a directory.
...
...
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