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
01109739
Kaydet (Commit)
01109739
authored
Ock 13, 2014
tarafından
Senthil Kumaran
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #19082: Working SimpleXMLRPCServer and xmlrpclib examples, both in modules and documentation.
üst
e198692c
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
40 additions
and
11 deletions
+40
-11
simplexmlrpcserver.rst
Doc/library/simplexmlrpcserver.rst
+32
-0
SimpleXMLRPCServer.py
Lib/SimpleXMLRPCServer.py
+1
-0
xmlrpclib.py
Lib/xmlrpclib.py
+4
-11
NEWS
Misc/NEWS
+3
-0
No files found.
Doc/library/simplexmlrpcserver.rst
Dosyayı görüntüle @
01109739
...
@@ -197,6 +197,38 @@ server::
...
@@ -197,6 +197,38 @@ server::
# Print list of available methods
# Print list of available methods
print s.system.listMethods()
print s.system.listMethods()
The following :class:`SimpleXMLRPCServer` example is included in the module
`Lib/SimpleXMLRPCServer.py`::
server = SimpleXMLRPCServer(("localhost", 8000))
server.register_function(pow)
server.register_function(lambda x,y: x+y, 'add')
server.register_multicall_functions()
server.serve_forever()
This demo server can be run from the command line as::
python -m SimpleXMLRPCServer
Example client code which talks to the above server is included with
`Lib/xmlrpclib.py`::
server = ServerProxy("http://localhost:8000")
print server
multi = MultiCall(server)
multi.pow(2, 9)
multi.add(5, 1)
multi.add(24, 11)
try:
for response in multi():
print response
except Error, v:
print "ERROR", v
And the client can be invoked directly using the following command::
python -m xmlrpclib
CGIXMLRPCRequestHandler
CGIXMLRPCRequestHandler
-----------------------
-----------------------
...
...
Lib/SimpleXMLRPCServer.py
Dosyayı görüntüle @
01109739
...
@@ -704,4 +704,5 @@ if __name__ == '__main__':
...
@@ -704,4 +704,5 @@ if __name__ == '__main__':
server
=
SimpleXMLRPCServer
((
"localhost"
,
8000
))
server
=
SimpleXMLRPCServer
((
"localhost"
,
8000
))
server
.
register_function
(
pow
)
server
.
register_function
(
pow
)
server
.
register_function
(
lambda
x
,
y
:
x
+
y
,
'add'
)
server
.
register_function
(
lambda
x
,
y
:
x
+
y
,
'add'
)
server
.
register_multicall_functions
()
server
.
serve_forever
()
server
.
serve_forever
()
Lib/xmlrpclib.py
Dosyayı görüntüle @
01109739
...
@@ -1617,21 +1617,14 @@ Server = ServerProxy
...
@@ -1617,21 +1617,14 @@ Server = ServerProxy
if
__name__
==
"__main__"
:
if
__name__
==
"__main__"
:
# simple test program (from the XML-RPC specification)
server
=
ServerProxy
(
"http://localhost:8000"
)
# server = ServerProxy("http://localhost:8000") # local server
server
=
ServerProxy
(
"http://time.xmlrpc.com/RPC2"
)
print
server
print
server
try
:
print
server
.
currentTime
.
getCurrentTime
()
except
Error
,
v
:
print
"ERROR"
,
v
multi
=
MultiCall
(
server
)
multi
=
MultiCall
(
server
)
multi
.
currentTime
.
getCurrentTime
()
multi
.
pow
(
2
,
9
)
multi
.
currentTime
.
getCurrentTime
()
multi
.
add
(
5
,
1
)
multi
.
add
(
24
,
11
)
try
:
try
:
for
response
in
multi
():
for
response
in
multi
():
print
response
print
response
...
...
Misc/NEWS
Dosyayı görüntüle @
01109739
...
@@ -35,6 +35,9 @@ Core and Builtins
...
@@ -35,6 +35,9 @@ Core and Builtins
Library
Library
-------
-------
- Issue #19082: Working SimpleXMLRPCServer and xmlrpclib examples, both in
modules and documentation.
- Issue #13107: argparse and optparse no longer raises an exception when output
- Issue #13107: argparse and optparse no longer raises an exception when output
a help on environment with too small COLUMNS. Based on patch by
a help on environment with too small COLUMNS. Based on patch by
Elazar Gershuni.
Elazar Gershuni.
...
...
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