-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from appliedsec/feature/full_ssl_opts
deprecated individual ssl option parameters and added new ssl_opts parameter
- Loading branch information
Showing
14 changed files
with
70 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ python: | |
- "2.7" | ||
- "3.3" | ||
- "3.4" | ||
- "3.5" | ||
install: | ||
- "pip install -e ." | ||
- "pip install pytest" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,7 +22,6 @@ changes may be introduced. | |
- Currently only JSON-RPC is supported. We plan to add support for XML-RPC also. | ||
- The connection pooling system should be considered alpha-quality. We would love feedback, but don't expect | ||
a bug-free experience. | ||
- We plan to support Python 3.x (no testing has been done, but using 2to3 may work with little modification) | ||
|
||
## Installation | ||
|
||
|
@@ -57,16 +56,13 @@ for connection pooling. | |
```python | ||
from rpctools.jsonrpc import ServerProxy, Fault | ||
|
||
proxy = ServerProxy(uri='https://example.com/jsonrpc', | ||
ca_certs='/path/to/ca-bundle.crt', # PEM-encoded contatenated set of CA certificates | ||
validate_cert_hostname=True # (This is also the default.) | ||
) | ||
|
||
proxy = ServerProxy('https://example.com/jsonrpc', ssl_opts={ | ||
'ca_certs': '/path/to/ca-bundle.crt', # PEM-encoded contatenated set of CA certificates | ||
}) | ||
try: | ||
proxy.someServerMethod(param1, param2) | ||
except Fault: | ||
# Fault instances are used to communicate server-side exceptions. | ||
raise | ||
raise # Fault instances are used to communicate server-side exceptions. | ||
``` | ||
|
||
### ... with basic auth | ||
|
@@ -76,33 +72,27 @@ The underlying httplib library supports providing basic auth in the URI: | |
```python | ||
from rpctools.jsonrpc import ServerProxy, Fault | ||
|
||
proxy = ServerProxy(uri='https://foo:[email protected]/jsonrpc', | ||
ca_certs='/path/to/ca-bundle.crt' | ||
) | ||
|
||
proxy = ServerProxy('https://foo:[email protected]/jsonrpc') | ||
try: | ||
proxy.requiresAuth(param1, param2) | ||
except Fault: | ||
# Fault instances are used to communicate server-side exceptions. | ||
raise | ||
raise # Fault instances are used to communicate server-side exceptions. | ||
``` | ||
|
||
### ... or client certs | ||
|
||
```python | ||
from rpctools.jsonrpc import ServerProxy, Fault | ||
|
||
proxy = ServerProxy(uri='https://example.com/jsonrpc', | ||
key_file='/path/to/client.key', # PEM-encoded | ||
cert_file='/path/to/client.crt', # PEM-encoded | ||
ca_certs='/path/to/ca-bundle.crt' | ||
) | ||
|
||
proxy = ServerProxy('https://example.com/jsonrpc', ssl_opts={ | ||
keyfile='/path/to/client.key', # PEM-encoded | ||
certfile='/path/to/client.crt', # PEM-encoded | ||
ca_certs='/path/to/ca-bundle.crt' | ||
}) | ||
try: | ||
proxy.someServerMethod(param1, param2) | ||
except Fault: | ||
# Fault instances are used to communicate server-side exceptions. | ||
raise | ||
raise # Fault instances are used to communicate server-side exceptions. | ||
``` | ||
|
||
### ... connection pooling (ALPHA!) | ||
|
@@ -113,13 +103,10 @@ to use the connection pool feature. | |
```python | ||
from rpctools.jsonrpc import ServerProxy, Fault | ||
|
||
proxy = ServerProxy(uri='http://example.com/jsonrpc', | ||
pool_connections=True) | ||
|
||
proxy = ServerProxy('http://example.com/jsonrpc', pool_connections=True) | ||
for (param1, param2) in some_params_list: | ||
try: | ||
proxy.someServerMethod(param1, param2) | ||
except Fault: | ||
# Fault instances are used to communicate server-side exceptions. | ||
raise | ||
try: | ||
proxy.someServerMethod(param1, param2) | ||
except Fault: | ||
raise # Fault instances are used to communicate server-side exceptions. | ||
``` |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.