-
Notifications
You must be signed in to change notification settings - Fork 24
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 #12 from noisyboiler/0.7.6
0.7.6
- Loading branch information
Showing
15 changed files
with
344 additions
and
28 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
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 |
---|---|---|
@@ -1,27 +1,42 @@ | ||
import datetime | ||
|
||
from wampy.peers.clients import DefaultClient | ||
from wampy.roles import register_rpc | ||
from wampy.peers.clients import Client | ||
from wampy.roles.callee import register_rpc | ||
from wampy.roles.subscriber import subscribe | ||
|
||
|
||
class DateService(DefaultClient): | ||
""" A web service that returns the current date. | ||
class DateService(Client): | ||
""" A service that returns the current date. | ||
usage :: | ||
$ wampy run docs.examples.services:DateService --router http://example.com:port | ||
This service can then be called as such :: | ||
e.g. :: | ||
In [1]: from wampy.peers import WebClient | ||
In [2]: with WebClient(name="wampy", host="examaple.com", port=port) as client: | ||
...: date = client.rpc.get_todays_date() | ||
In [3]: date | ||
Out[3]: u'2016-11-26' | ||
$ crossbar start --config ./wampy/testing/configs/crossbar.config.json | ||
$ wampy run docs.examples.services:SubscribingService --router http://localhost:8080 | ||
""" | ||
@register_rpc | ||
def get_todays_date(self): | ||
return datetime.date.today().isoformat() | ||
|
||
|
||
class SubscribingService(Client): | ||
""" A service that prints out "foo" topic messages | ||
usage :: | ||
$ wampy run docs.examples.services:SubscribingService --router http://example.com:port | ||
e.g. :: | ||
$ crossbar start --config ./wampy/testing/configs/crossbar.config.json | ||
$ wampy run docs.examples.services:SubscribingService --router http://localhost:8080 | ||
""" | ||
|
||
@subscribe(topic="foo") | ||
def foo_handler(self, **kwargs): | ||
print("foo message received: {}".format(kwargs)) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import datetime | ||
from datetime import date | ||
|
||
from wampy.peers.clients import Client | ||
from wampy.roles.callee import rpc | ||
|
||
|
||
class DateService(Client): | ||
|
||
@rpc | ||
def get_todays_date(self): | ||
return datetime.date.today().isoformat() | ||
|
||
|
||
def test_connection(router): | ||
service = DateService(router=router, transport="ws") | ||
with service: | ||
|
||
client = Client(router=router, transport="ws") | ||
|
||
with client: | ||
result = client.rpc.get_todays_date() | ||
|
||
today = date.today() | ||
|
||
assert result == today.isoformat() | ||
|
||
|
||
def test_secure_connection(tls_router): | ||
service = DateService(router=tls_router, transport="wss") | ||
with service: | ||
|
||
client = Client(router=tls_router, transport="wss") | ||
|
||
with client: | ||
result = client.rpc.get_todays_date() | ||
|
||
today = date.today() | ||
|
||
assert result == today.isoformat() |
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
File renamed without changes.
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 |
---|---|---|
@@ -0,0 +1,59 @@ | ||
{ | ||
"version":2, | ||
"workers":[ | ||
{ | ||
"type":"router", | ||
"realms":[ | ||
{ | ||
"name":"realm1", | ||
"roles":[ | ||
{ | ||
"name":"anonymous", | ||
"permissions":[ | ||
{ | ||
"uri":"", | ||
"match":"prefix", | ||
"allow":{ | ||
"call":true, | ||
"register":true, | ||
"publish":true, | ||
"subscribe":true | ||
}, | ||
"disclose":{ | ||
"caller":false, | ||
"publisher":false | ||
}, | ||
"cache":true | ||
} | ||
] | ||
} | ||
] | ||
} | ||
], | ||
"transports":[ | ||
{ | ||
"type":"web", | ||
"endpoint":{ | ||
"type":"tcp", | ||
"port":8080, | ||
"tls":{ | ||
"key":"./wampy/testing/keys/server_key.pem", | ||
"certificate":"./wampy/testing/keys/server_cert.pem", | ||
"dhparam":"./wampy/testing/keys/dhparam.pem", | ||
"ciphers":"ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:ECDH+3DES:DH+3DES:RSA+AES:RSA+3DES:!ADH:!AECDH:!MD5:!DSS" | ||
} | ||
}, | ||
"paths":{ | ||
"/":{ | ||
"type":"static", | ||
"directory":"./wampy/testing/" | ||
}, | ||
"ws":{ | ||
"type":"websocket" | ||
} | ||
} | ||
} | ||
] | ||
} | ||
] | ||
} |
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
-----BEGIN DH PARAMETERS----- | ||
MIGHAoGBALOSAAEXXAZLxNbZOw92qfwJtToq1eiVr8vF7jhVESvZXviE/nwHVYw3 | ||
IkbjFJDK+6kwH+KGpMGf4DYDraRpiArLOoveL8swh3WouKAEl0o5yoLwUi072W8j | ||
SSPEGqRh+19r2HNo25/mgxF9ddMKFalGzURM2oTl4y+ZXaIt6GsTAgEC | ||
-----END DH PARAMETERS----- |
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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
-----BEGIN CERTIFICATE----- | ||
MIIDNjCCAh4CCQCP5LnGD/PkTDANBgkqhkiG9w0BAQUFADBdMQswCQYDVQQGEwJE | ||
RTEQMA4GA1UECAwHQmF2YXJpYTERMA8GA1UEBwwIRXJsYW5nZW4xFTATBgNVBAoM | ||
DFRhdmVuZG8gR21iSDESMBAGA1UEAwwJbG9jYWxob3N0MB4XDTE0MTEwNjIxMjIx | ||
MloXDTI0MTEwMzIxMjIxMlowXTELMAkGA1UEBhMCREUxEDAOBgNVBAgMB0JhdmFy | ||
aWExETAPBgNVBAcMCEVybGFuZ2VuMRUwEwYDVQQKDAxUYXZlbmRvIEdtYkgxEjAQ | ||
BgNVBAMMCWxvY2FsaG9zdDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB | ||
AK54iBXPWPyCGlsrGhBV1xkrfubttugoqADvfYP9eptzqOCzcAqtlWLFYf1tDGbT | ||
mkwNsgV/lJKVzGMyosSAuRBmolRTQeyBcypsX9QJt6s/PJ2vh3v2QQ7DWlokZGhx | ||
sCX6p6GEUbcBo61Yc+AvhAmJ+olYyLqp8nCIJFy0F+P7qvxx1B6pg08J/d75/m9A | ||
BiGgZ0WjYLrDj0yERWX3WljuYIT4e34WMPofaBeiMTQEpqdgTbuSgpXdNdlzuWaq | ||
gn8ITIHMnf5mlnCeU1rsHMJwJAUzRR9S40Km4WNxIP4/j+uVwMQLcJg73ni43n5V | ||
xza6fgCQGfe8HQLxItwoU0MCAwEAATANBgkqhkiG9w0BAQUFAAOCAQEAEsiNnmRU | ||
O4UW2AjI5EIr1Na7Xae8NZyIGrH+ONJUxaQxrpj1Q/bHmN7ZPFIDkZ2NX0rZBWwC | ||
gbLSG0HIK2CdA+ghW0RaOnQgzLoJKJCERMSYDL26AXBJ4L0h5U43rsgXTD/zaWid | ||
9B90pxSCXvSnA+yw1U67Lgm1x9LEkgpGWpqPlHQBMvwi4gkkdUsPxBLCie4TfX+p | ||
gB51+Rjh8HaLl9tc0Z1JcjhK7ih1kz6A6XF7GaMvW0ipZYX/xIkUQNMTKhfdrrms | ||
qr2GdKmJpFKJhrvYpbx560R0ZT2Sxic8EOLjfWfvxD56xTU6ssosw1oYdRB2W9i7 | ||
hsK8dBzPGj1ZcQ== | ||
-----END CERTIFICATE----- |
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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
-----BEGIN RSA PRIVATE KEY----- | ||
MIIEpAIBAAKCAQEArniIFc9Y/IIaWysaEFXXGSt+5u226CioAO99g/16m3Oo4LNw | ||
Cq2VYsVh/W0MZtOaTA2yBX+UkpXMYzKixIC5EGaiVFNB7IFzKmxf1Am3qz88na+H | ||
e/ZBDsNaWiRkaHGwJfqnoYRRtwGjrVhz4C+ECYn6iVjIuqnycIgkXLQX4/uq/HHU | ||
HqmDTwn93vn+b0AGIaBnRaNgusOPTIRFZfdaWO5ghPh7fhYw+h9oF6IxNASmp2BN | ||
u5KCld012XO5ZqqCfwhMgcyd/maWcJ5TWuwcwnAkBTNFH1LjQqbhY3Eg/j+P65XA | ||
xAtwmDveeLjeflXHNrp+AJAZ97wdAvEi3ChTQwIDAQABAoIBAD0R+7CGr8NTVx5q | ||
a+kj4vLwgq8arld9Q7FwIyM8atpXFdnxdVqHgC7eoHow3ZJwpyXP9WxvR/Y3cR+X | ||
7dmSpTTUeCXELuM2PLWw0apK7HuI2xLnCimd/Q/J2aqL6omUoe/pWRv0URYaAM0A | ||
lS738uPT5FqHNVwBeNdjEDdS4rnuHei1wYwWKlZ5aTRaO21g0Ya67fY7AKRFuKEn | ||
TxGmgA/cKT+RCoztBSys1vY4vuBBhsZXBzSWjkQE/nh5FiZ/rDvmtPeBn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