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
efa3cf84
Commit
efa3cf84
authored
Nov 29, 2014
by
Benjamin Peterson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add context parameter to xmlrpclib.ServerProxy (#22960)
Patch from Alex Gaynor.
parent
209dd468
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
6 deletions
+26
-6
Doc/library/xmlrpclib.rst
Doc/library/xmlrpclib.rst
+8
-3
Lib/xmlrpclib.py
Lib/xmlrpclib.py
+7
-3
Misc/NEWS
Misc/NEWS
+11
-0
No files found.
Doc/library/xmlrpclib.rst
View file @
efa3cf84
...
...
@@ -39,7 +39,7 @@ between conformable Python objects and XML on the wire.
For https URIs, :mod:`xmlrpclib` now performs all the necessary certificate
and hostname checks by default
.. class:: ServerProxy(uri[, transport[, encoding[, verbose[,
allow_none[, use_datetime
]]]]])
.. class:: ServerProxy(uri[, transport[, encoding[, verbose[,
allow_none[, use_datetime[, context]
]]]]])
A :class:`ServerProxy` instance is an object that manages communication with a
remote XML-RPC server. The required first argument is a URI (Uniform Resource
...
...
@@ -57,11 +57,13 @@ between conformable Python objects and XML on the wire.
:class:`datetime.datetime` objects may be passed to calls.
Both the HTTP and HTTPS transports support the URL syntax extension for HTTP
Basic Authentication: ``http://user:pass@host:port/path``. The
``user:pass``
Basic Authentication: ``http://user:pass@host:port/path``. The ``user:pass``
portion will be base64-encoded as an HTTP 'Authorization' header, and sent to
the remote server as part of the connection process when invoking an XML-RPC
method. You only need to use this if the remote server requires a Basic
Authentication user and password.
Authentication user and password. If an HTTPS url is provided, *context* may
be :class:`ssl.SSLContext` and configures the SSL settings of the underlying
HTTPS connection.
The returned instance is a proxy object with methods that can be used to invoke
corresponding RPC calls on the remote server. If the remote server supports the
...
...
@@ -131,6 +133,9 @@ between conformable Python objects and XML on the wire.
*__dict__* attribute and don't have a base class that is marshalled in a
special way.
.. versionchanged:: 2.7.9
Added the *context* argument.
.. seealso::
...
...
Lib/xmlrpclib.py
View file @
efa3cf84
...
...
@@ -1478,6 +1478,10 @@ class Transport:
class
SafeTransport
(
Transport
):
"""Handles an HTTPS transaction to an XML-RPC server."""
def
__init__
(
self
,
use_datetime
=
0
,
context
=
None
):
Transport
.
__init__
(
self
,
use_datetime
=
use_datetime
)
self
.
context
=
context
# FIXME: mostly untested
def
make_connection
(
self
,
host
):
...
...
@@ -1493,7 +1497,7 @@ class SafeTransport(Transport):
)
else
:
chost
,
self
.
_extra_headers
,
x509
=
self
.
get_host_info
(
host
)
self
.
_connection
=
host
,
HTTPS
(
chost
,
None
,
**
(
x509
or
{}))
self
.
_connection
=
host
,
HTTPS
(
chost
,
None
,
context
=
context
,
**
(
x509
or
{}))
return
self
.
_connection
[
1
]
##
...
...
@@ -1536,7 +1540,7 @@ class ServerProxy:
"""
def
__init__
(
self
,
uri
,
transport
=
None
,
encoding
=
None
,
verbose
=
0
,
allow_none
=
0
,
use_datetime
=
0
):
allow_none
=
0
,
use_datetime
=
0
,
context
=
None
):
# establish a "logical" server connection
if
isinstance
(
uri
,
unicode
):
...
...
@@ -1553,7 +1557,7 @@ class ServerProxy:
if
transport
is
None
:
if
type
==
"https"
:
transport
=
SafeTransport
(
use_datetime
=
use_datetime
)
transport
=
SafeTransport
(
use_datetime
=
use_datetime
,
context
=
context
)
else
:
transport
=
Transport
(
use_datetime
=
use_datetime
)
self
.
__transport
=
transport
...
...
Misc/NEWS
View file @
efa3cf84
...
...
@@ -2,6 +2,17 @@
Python
News
+++++++++++
What
's New in Python 2.7.9?
===========================
*Release date: 2014-12-XX*
Library
-------
- Issue #22960: Add a context argument to xmlrpclib.ServerProxy.
What'
s
New
in
Python
2.7.9
release
candidate
1
?
===============================================
...
...
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