Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
432be360
Commit
432be360
authored
Dec 08, 2005
by
Andrew M. Kuchling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Bug #1349316] Show how to use XML-RPC through a proxy
parent
ef1b50de
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
0 deletions
+27
-0
Doc/lib/libxmlrpclib.tex
Doc/lib/libxmlrpclib.tex
+27
-0
No files found.
Doc/lib/libxmlrpclib.tex
View file @
432be360
...
...
@@ -355,3 +355,30 @@ try:
except Error, v:
print "ERROR", v
\end{verbatim}
To access an XML-RPC server through a proxy, you need to define
a custom transport. The following example,
written by NoboNobo,
% fill in original author's name if we ever learn it
shows how:
% Example taken from http://lowlife.jp/nobonobo/wiki/xmlrpcwithproxy.html
\begin{verbatim}
import xmlrpclib, httplib
class ProxiedTransport(xmlrpclib.Transport):
def set
_
proxy(self, proxy):
self.proxy = proxy
def make
_
connection(self, host):
self.realhost = host
h = httplib.HTTP(self.proxy)
return h
def send
_
request(self, connection, handler, request
_
body):
connection.putrequest("POST", 'http://
%s%s' % (self.realhost, handler))
def send
_
host(self, connection, host):
connection.putheader('Host', self.realhost)
p = ProxiedTransport()
p.set
_
proxy('proxy-server:8080')
server = xmlrpclib.Server('http://time.xmlrpc.com/RPC2', transport=p)
print server.currentTime.getCurrentTime()
\end{verbatim}
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