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
3e446127
Kaydet (Commit)
3e446127
authored
Tem 20, 2011
tarafından
Senthil Kumaran
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
merge from 3.2 - Fix closes issue12524 - update http.client POST example with a working example.
üst
fb96089b
96c84a4c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
4 deletions
+6
-4
http.client.rst
Doc/library/http.client.rst
+6
-4
No files found.
Doc/library/http.client.rst
Dosyayı görüntüle @
3e446127
...
@@ -592,15 +592,17 @@ Here is an example session that uses the ``HEAD`` method. Note that the
...
@@ -592,15 +592,17 @@ Here is an example session that uses the ``HEAD`` method. Note that the
Here is an example session that shows how to ``POST`` requests::
Here is an example session that shows how to ``POST`` requests::
>>> import http.client, urllib.parse
>>> import http.client, urllib.parse
>>> params = urllib.parse.urlencode({'
spam': 1, 'eggs': 2, 'bacon': 0
})
>>> params = urllib.parse.urlencode({'
@number': 12524, '@type': 'issue', '@action': 'show'
})
>>> headers = {"Content-type": "application/x-www-form-urlencoded",
>>> headers = {"Content-type": "application/x-www-form-urlencoded",
... "Accept": "text/plain"}
... "Accept": "text/plain"}
>>> conn = http.client.HTTPConnection("
musi-cal.mojam.com:80
")
>>> conn = http.client.HTTPConnection("
bugs.python.org
")
>>> conn.request("POST", "
/cgi-bin/query
", params, headers)
>>> conn.request("POST", "", params, headers)
>>> response = conn.getresponse()
>>> response = conn.getresponse()
>>> print(response.status, response.reason)
>>> print(response.status, response.reason)
200 OK
302 Found
>>> data = response.read()
>>> data = response.read()
>>> data
b'Redirecting to <a href="http://bugs.python.org/issue12524">http://bugs.python.org/issue12524</a>'
>>> conn.close()
>>> conn.close()
...
...
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