Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,23 @@ poetry install
Execute by running

```bash
./run.sh login
poetry shell
nox
```

Execute a specific nox environment:

```bash
nox -e <env_name>
```

Note: a list of available environments can be found with:

```bash
nox --list-sessions
```

### Packaging

```
Expand Down
4 changes: 4 additions & 0 deletions swampyer/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
import websocket
import traceback

from datetime import date, datetime

from .common import *
from .utils import logger
from .exceptions import *
Expand Down Expand Up @@ -50,6 +52,8 @@ def default(self, obj):
return float(obj)
elif isinstance(obj, memoryview):
return self.default(bytes(obj))
elif isinstance(obj, (datetime, date)):
return obj.isoformat()
elif isinstance(obj, bytes):
try:
return obj.decode()
Expand Down
16 changes: 16 additions & 0 deletions tests/test_06_protocols.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/python
from datetime import datetime

from lib import *

Expand Down Expand Up @@ -34,6 +35,21 @@ def test_connection():
except Exception as ex:
raise

# Send a datetime object, ensure it falls back to
# isoformat().
obj = datetime.now()
try:
client_json.publish(
'com.izaber.wamp.pub.hello',
options={
'acknowledge': True,
'exclude_me': False,
},
args=[obj]
)
except Exception as ex:
raise

print("Check CBOR")
client_cbor = connect_service(serializer_code='cbor')
result = client_cbor.publish(
Expand Down