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
838521ee
Kaydet (Commit)
838521ee
authored
Eyl 22, 2013
tarafından
Jason R. Coombs
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
Close #18978: Merge changes.
üst
f94a16b4
ea9e0974
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
7 deletions
+16
-7
test_urllib2.py
Lib/test/test_urllib2.py
+9
-0
request.py
Lib/urllib/request.py
+4
-7
NEWS
Misc/NEWS
+3
-0
No files found.
Lib/test/test_urllib2.py
Dosyayı görüntüle @
838521ee
...
...
@@ -1466,16 +1466,25 @@ class MiscTests(unittest.TestCase):
self
.
assertEqual
(
str
(
err
),
expected_errmsg
)
class
RequestTests
(
unittest
.
TestCase
):
class
PutRequest
(
Request
):
method
=
'PUT'
def
setUp
(
self
):
self
.
get
=
Request
(
"http://www.python.org/~jeremy/"
)
self
.
post
=
Request
(
"http://www.python.org/~jeremy/"
,
"data"
,
headers
=
{
"X-Test"
:
"test"
})
self
.
head
=
Request
(
"http://www.python.org/~jeremy/"
,
method
=
'HEAD'
)
self
.
put
=
self
.
PutRequest
(
"http://www.python.org/~jeremy/"
)
self
.
force_post
=
self
.
PutRequest
(
"http://www.python.org/~jeremy/"
,
method
=
"POST"
)
def
test_method
(
self
):
self
.
assertEqual
(
"POST"
,
self
.
post
.
get_method
())
self
.
assertEqual
(
"GET"
,
self
.
get
.
get_method
())
self
.
assertEqual
(
"HEAD"
,
self
.
head
.
get_method
())
self
.
assertEqual
(
"PUT"
,
self
.
put
.
get_method
())
self
.
assertEqual
(
"POST"
,
self
.
force_post
.
get_method
())
def
test_data
(
self
):
self
.
assertFalse
(
self
.
get
.
data
)
...
...
Lib/urllib/request.py
Dosyayı görüntüle @
838521ee
...
...
@@ -271,7 +271,8 @@ class Request:
origin_req_host
=
request_host
(
self
)
self
.
origin_req_host
=
origin_req_host
self
.
unverifiable
=
unverifiable
self
.
method
=
method
if
method
:
self
.
method
=
method
@property
def
full_url
(
self
):
...
...
@@ -320,12 +321,8 @@ class Request:
def
get_method
(
self
):
"""Return a string indicating the HTTP request method."""
if
self
.
method
is
not
None
:
return
self
.
method
elif
self
.
data
is
not
None
:
return
"POST"
else
:
return
"GET"
default_method
=
"POST"
if
self
.
data
is
not
None
else
"GET"
return
getattr
(
self
,
'method'
,
default_method
)
def
get_full_url
(
self
):
return
self
.
full_url
...
...
Misc/NEWS
Dosyayı görüntüle @
838521ee
...
...
@@ -12,6 +12,9 @@ Core and Builtins
Library
-------
-
Issue
#
18978
:
``
urllib
.
request
.
Request
``
now
allows
the
method
to
be
indicated
on
the
class
and
no
longer
sets
it
to
None
in
``
__init__
``.
-
Issue
#
18626
:
the
inspect
module
now
offers
a
basic
command
line
introspection
interface
(
Initial
patch
by
Claudiu
Popa
)
...
...
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